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 #include "content/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/threading/simple_thread.h" | 23 #include "base/threading/simple_thread.h" |
24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
25 #include "base/threading/thread_checker.h" | 25 #include "base/threading/thread_checker.h" |
26 #include "cc/base/switches.h" | 26 #include "cc/base/switches.h" |
27 #include "cc/input/input_handler.h" | 27 #include "cc/input/input_handler.h" |
28 #include "cc/layers/layer.h" | 28 #include "cc/layers/layer.h" |
29 #include "cc/output/compositor_frame.h" | 29 #include "cc/output/compositor_frame.h" |
30 #include "cc/output/context_provider.h" | 30 #include "cc/output/context_provider.h" |
31 #include "cc/output/output_surface.h" | 31 #include "cc/output/output_surface.h" |
32 #include "cc/output/output_surface_client.h" | 32 #include "cc/output/output_surface_client.h" |
33 #include "cc/raster/task_graph_runner.h" | 33 #include "cc/raster/single_thread_task_graph_runner.h" |
34 #include "cc/scheduler/begin_frame_source.h" | 34 #include "cc/scheduler/begin_frame_source.h" |
35 #include "cc/surfaces/onscreen_display_client.h" | 35 #include "cc/surfaces/onscreen_display_client.h" |
36 #include "cc/surfaces/surface_display_output_surface.h" | 36 #include "cc/surfaces/surface_display_output_surface.h" |
37 #include "cc/surfaces/surface_id_allocator.h" | 37 #include "cc/surfaces/surface_id_allocator.h" |
38 #include "cc/surfaces/surface_manager.h" | 38 #include "cc/surfaces/surface_manager.h" |
39 #include "cc/trees/layer_tree_host.h" | 39 #include "cc/trees/layer_tree_host.h" |
40 #include "cc/trees/layer_tree_settings.h" | 40 #include "cc/trees/layer_tree_settings.h" |
41 #include "content/browser/android/child_process_launcher_android.h" | 41 #include "content/browser/android/child_process_launcher_android.h" |
42 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 42 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
43 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 43 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 gfx::SwapResult)> | 142 gfx::SwapResult)> |
143 swap_buffers_completion_callback_; | 143 swap_buffers_completion_callback_; |
144 }; | 144 }; |
145 | 145 |
146 static bool g_initialized = false; | 146 static bool g_initialized = false; |
147 | 147 |
148 bool g_use_surface_manager = false; | 148 bool g_use_surface_manager = false; |
149 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 149 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
150 LAZY_INSTANCE_INITIALIZER; | 150 LAZY_INSTANCE_INITIALIZER; |
151 | 151 |
152 | |
153 int g_surface_id_namespace = 0; | 152 int g_surface_id_namespace = 0; |
154 | 153 |
155 class SingleThreadTaskGraphRunner | 154 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { |
156 : public cc::TaskGraphRunner, | |
157 public base::DelegateSimpleThread::Delegate { | |
158 public: | 155 public: |
159 SingleThreadTaskGraphRunner() | 156 SingleThreadTaskGraphRunner() { |
160 : worker_thread_( | 157 Start("CompositorTileWorker1", |
161 this, | 158 base::SimpleThread::Options(base::ThreadPriority::BACKGROUND)); |
162 "CompositorTileWorker1", | |
163 base::SimpleThread::Options(base::ThreadPriority::BACKGROUND)) { | |
164 worker_thread_.Start(); | |
165 } | 159 } |
166 | 160 |
167 ~SingleThreadTaskGraphRunner() override { | 161 ~SingleThreadTaskGraphRunner() override { |
168 Shutdown(); | 162 Shutdown(); |
169 worker_thread_.Join(); | |
170 } | 163 } |
171 | |
172 private: | |
173 // Overridden from base::DelegateSimpleThread::Delegate: | |
174 void Run() override { cc::TaskGraphRunner::Run(); } | |
175 | |
176 base::DelegateSimpleThread worker_thread_; | |
177 }; | 164 }; |
178 | 165 |
179 base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner = | 166 base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner = |
180 LAZY_INSTANCE_INITIALIZER; | 167 LAZY_INSTANCE_INITIALIZER; |
181 | 168 |
182 } // anonymous namespace | 169 } // anonymous namespace |
183 | 170 |
184 // static | 171 // static |
185 Compositor* Compositor::Create(CompositorClient* client, | 172 Compositor* Compositor::Create(CompositorClient* client, |
186 gfx::NativeWindow root_window) { | 173 gfx::NativeWindow root_window) { |
187 return client ? new CompositorImpl(client, root_window) : NULL; | 174 return client ? new CompositorImpl(client, root_window) : NULL; |
188 } | 175 } |
189 | 176 |
190 // static | 177 // static |
191 void Compositor::Initialize() { | 178 void Compositor::Initialize() { |
192 DCHECK(!CompositorImpl::IsInitialized()); | 179 DCHECK(!CompositorImpl::IsInitialized()); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 786 |
800 void CompositorImpl::SetNeedsAnimate() { | 787 void CompositorImpl::SetNeedsAnimate() { |
801 needs_animate_ = true; | 788 needs_animate_ = true; |
802 if (!host_->visible()) | 789 if (!host_->visible()) |
803 return; | 790 return; |
804 | 791 |
805 host_->SetNeedsAnimate(); | 792 host_->SetNeedsAnimate(); |
806 } | 793 } |
807 | 794 |
808 } // namespace content | 795 } // namespace content |
OLD | NEW |