web_contents_proxy_impl.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PERFORMANCE_MANAGER_WEB_CONTENTS_PROXY_IMPL_H_
  5. #define COMPONENTS_PERFORMANCE_MANAGER_WEB_CONTENTS_PROXY_IMPL_H_
  6. #include <cstdint>
  7. namespace content {
  8. class WebContents;
  9. } // namespace content
  10. namespace performance_manager {
  11. // A WebContentsProxyImpl is used to post messages out of the performance
  12. // manager sequence that are bound for a WebContents running on the UI thread.
  13. // The object is bound to the UI thread. A WeakPtr<WebContentsProxyImpl> is
  14. // effectively equivalent to a WeakPtr<WebContents>.
  15. //
  16. // This class is opaquely embedded in a WebContentsProxy, which hides the fact
  17. // that a weak pointer is being used under the hood.
  18. class WebContentsProxyImpl {
  19. public:
  20. WebContentsProxyImpl();
  21. WebContentsProxyImpl(const WebContentsProxyImpl&) = delete;
  22. WebContentsProxyImpl& operator=(const WebContentsProxyImpl&) = delete;
  23. virtual ~WebContentsProxyImpl();
  24. // Allows resolving this proxy to the underlying WebContents. This must only
  25. // be called on the UI thread.
  26. virtual content::WebContents* GetWebContents() const = 0;
  27. // Returns the ID of the last committed navigation in the main frame of the
  28. // web contents. This must only be called on the UI thread.
  29. virtual int64_t LastNavigationId() const = 0;
  30. // Similar to the above, but for the last non same-document navigation
  31. // associated with this WebContents. This is always for a navigation that is
  32. // older or equal to "LastNavigationId". This must only be called on the UI
  33. // thread.
  34. virtual int64_t LastNewDocNavigationId() const = 0;
  35. };
  36. } // namespace performance_manager
  37. #endif // COMPONENTS_PERFORMANCE_MANAGER_WEB_CONTENTS_PROXY_IMPL_H_