Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_COMPOSITOR_FRAME_CONSUMER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_COMPOSITOR_FRAME_CONSUMER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_COMPOSITOR_FRAME_CONSUMER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_COMPOSITOR_FRAME_CONSUMER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "android_webview/browser/parent_compositor_draw_constraints.h" | 10 #include "android_webview/browser/parent_compositor_draw_constraints.h" |
| 11 #include "cc/resources/returned_resource.h" | 11 #include "cc/resources/returned_resource.h" |
| 12 #include "ui/gfx/geometry/vector2d.h" | 12 #include "ui/gfx/geometry/vector2d.h" |
| 13 | 13 |
| 14 namespace android_webview { | 14 namespace android_webview { |
| 15 | 15 |
| 16 class ChildFrame; | 16 class ChildFrame; |
| 17 class CompositorFrameProducer; | 17 class CompositorFrameProducer; |
| 18 | 18 |
| 19 class CompositorFrameConsumer { | 19 class CompositorFrameConsumer { |
| 20 public: | 20 public: |
| 21 struct ReturnedResources { | 21 struct ReturnedResources { |
| 22 ReturnedResources(); | 22 ReturnedResources(); |
| 23 ~ReturnedResources(); | 23 ~ReturnedResources(); |
| 24 | 24 |
| 25 uint32_t output_surface_id; | 25 uint32_t output_surface_id; |
| 26 cc::ReturnedResourceArray resources; | 26 cc::ReturnedResourceArray resources; |
| 27 }; | 27 }; |
| 28 using ReturnedResourcesMap = std::map<uint32_t, ReturnedResources>; | 28 using ReturnedResourcesMap = std::map<uint32_t, ReturnedResources>; |
| 29 | 29 |
| 30 // A CompositorFrameConsumer may be registered with at most one | |
| 31 // CompositorFrameProducer. The producer is responsible for | |
| 32 // managing the relationship with its consumers. In order to | |
| 33 // register a consumer with a new producer, the current producer | |
| 34 // must first unregister the consumer, and call | |
| 35 // SetCompositorProducer(nullptr). | |
| 30 virtual void SetCompositorFrameProducer( | 36 virtual void SetCompositorFrameProducer( |
| 31 CompositorFrameProducer* compositor_frame_producer) = 0; | 37 CompositorFrameProducer* compositor_frame_producer) = 0; |
| 38 virtual CompositorFrameProducer* GetCompositorFrameProducer() = 0; | |
|
boliu
2016/05/05 14:09:34
make sure this is removed when the caller is remov
Tobias Sargeant
2016/05/05 19:06:46
Done.
| |
| 39 | |
| 32 virtual void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) = 0; | 40 virtual void SetScrollOffsetOnUI(gfx::Vector2d scroll_offset) = 0; |
| 33 virtual void SetFrameOnUI(std::unique_ptr<ChildFrame> frame) = 0; | 41 virtual void SetFrameOnUI(std::unique_ptr<ChildFrame> frame) = 0; |
| 34 virtual void InitializeHardwareDrawIfNeededOnUI() = 0; | 42 virtual void InitializeHardwareDrawIfNeededOnUI() = 0; |
| 35 virtual ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() | 43 virtual ParentCompositorDrawConstraints GetParentDrawConstraintsOnUI() |
| 36 const = 0; | 44 const = 0; |
| 37 virtual void SwapReturnedResourcesOnUI( | 45 virtual void SwapReturnedResourcesOnUI( |
| 38 ReturnedResourcesMap* returned_resource_map) = 0; | 46 ReturnedResourcesMap* returned_resource_map) = 0; |
| 39 virtual bool ReturnedResourcesEmptyOnUI() const = 0; | 47 virtual bool ReturnedResourcesEmptyOnUI() const = 0; |
| 40 virtual std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI() = 0; | 48 virtual std::unique_ptr<ChildFrame> PassUncommittedFrameOnUI() = 0; |
| 41 virtual bool HasFrameOnUI() const = 0; | 49 virtual bool HasFrameOnUI() const = 0; |
| 42 virtual void DeleteHardwareRendererOnUI() = 0; | 50 virtual void DeleteHardwareRendererOnUI() = 0; |
| 43 | 51 |
| 44 protected: | 52 protected: |
| 45 virtual ~CompositorFrameConsumer() {} | 53 virtual ~CompositorFrameConsumer() {} |
| 46 }; | 54 }; |
| 47 | 55 |
| 48 } // namespace android_webview | 56 } // namespace android_webview |
| 49 | 57 |
| 50 #endif // ANDROID_WEBVIEW_BROWSER_COMPOSITOR_FRAME_PRODUCER_H_ | 58 #endif // ANDROID_WEBVIEW_BROWSER_COMPOSITOR_FRAME_PRODUCER_H_ |
| OLD | NEW |