OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
| 11 #include <unordered_set> |
11 | 12 |
12 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
17 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
18 #include "cc/surfaces/frame_sink_id.h" | 19 #include "cc/surfaces/frame_sink_id.h" |
19 #include "cc/trees/layer_tree_host_client.h" | 20 #include "cc/trees/layer_tree_host_client.h" |
20 #include "cc/trees/layer_tree_host_single_thread_client.h" | 21 #include "cc/trees/layer_tree_host_single_thread_client.h" |
(...skipping 29 matching lines...) Expand all Loading... |
50 : public Compositor, | 51 : public Compositor, |
51 public cc::LayerTreeHostClient, | 52 public cc::LayerTreeHostClient, |
52 public cc::LayerTreeHostSingleThreadClient, | 53 public cc::LayerTreeHostSingleThreadClient, |
53 public ui::UIResourceProvider, | 54 public ui::UIResourceProvider, |
54 public ui::WindowAndroidCompositor { | 55 public ui::WindowAndroidCompositor { |
55 public: | 56 public: |
56 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); | 57 CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window); |
57 ~CompositorImpl() override; | 58 ~CompositorImpl() override; |
58 | 59 |
59 static bool IsInitialized(); | 60 static bool IsInitialized(); |
| 61 void AddChildFrameSink(const cc::FrameSinkId& frame_sink_id); |
| 62 void RemoveChildFrameSink(const cc::FrameSinkId& frame_sink_id); |
60 | 63 |
61 // ui::ResourceProvider implementation. | 64 // ui::ResourceProvider implementation. |
62 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; | 65 cc::UIResourceId CreateUIResource(cc::UIResourceClient* client) override; |
63 void DeleteUIResource(cc::UIResourceId resource_id) override; | 66 void DeleteUIResource(cc::UIResourceId resource_id) override; |
64 bool SupportsETC1NonPowerOfTwo() const override; | 67 bool SupportsETC1NonPowerOfTwo() const override; |
65 | 68 |
66 private: | 69 private: |
67 // Compositor implementation. | 70 // Compositor implementation. |
68 void SetRootLayer(scoped_refptr<cc::Layer> root) override; | 71 void SetRootLayer(scoped_refptr<cc::Layer> root) override; |
69 void SetSurface(jobject surface) override; | 72 void SetSurface(jobject surface) override; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 161 |
159 size_t num_successive_context_creation_failures_; | 162 size_t num_successive_context_creation_failures_; |
160 | 163 |
161 // Whether there is an CompositorFrameSink request pending from the current | 164 // Whether there is an CompositorFrameSink request pending from the current |
162 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and | 165 // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and |
163 // |false| if |host_| is deleted or we succeed in creating *and* initializing | 166 // |false| if |host_| is deleted or we succeed in creating *and* initializing |
164 // a CompositorFrameSink (which is essentially the contract with cc). | 167 // a CompositorFrameSink (which is essentially the contract with cc). |
165 bool compositor_frame_sink_request_pending_; | 168 bool compositor_frame_sink_request_pending_; |
166 | 169 |
167 gpu::Capabilities gpu_capabilities_; | 170 gpu::Capabilities gpu_capabilities_; |
| 171 bool has_compositor_frame_sink_ = false; |
| 172 std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> |
| 173 pending_child_frame_sink_ids_; |
| 174 |
168 base::WeakPtrFactory<CompositorImpl> weak_factory_; | 175 base::WeakPtrFactory<CompositorImpl> weak_factory_; |
169 | 176 |
170 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); | 177 DISALLOW_COPY_AND_ASSIGN(CompositorImpl); |
171 }; | 178 }; |
172 | 179 |
173 } // namespace content | 180 } // namespace content |
174 | 181 |
175 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ | 182 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_ |
OLD | NEW |