| 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/compositor/browser_compositor_overlay_candidate_valida
tor_android.h" | 42 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor_android.h" |
| 43 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 43 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 swap_buffers_completion_callback_; | 150 swap_buffers_completion_callback_; |
| 151 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; | 151 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator_; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 static bool g_initialized = false; | 154 static bool g_initialized = false; |
| 155 | 155 |
| 156 bool g_use_surface_manager = false; | 156 bool g_use_surface_manager = false; |
| 157 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | 157 base::LazyInstance<cc::SurfaceManager> g_surface_manager = |
| 158 LAZY_INSTANCE_INITIALIZER; | 158 LAZY_INSTANCE_INITIALIZER; |
| 159 | 159 |
| 160 | |
| 161 int g_surface_id_namespace = 0; | 160 int g_surface_id_namespace = 0; |
| 162 | 161 |
| 163 class SingleThreadTaskGraphRunner | 162 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { |
| 164 : public cc::TaskGraphRunner, | |
| 165 public base::DelegateSimpleThread::Delegate { | |
| 166 public: | 163 public: |
| 167 SingleThreadTaskGraphRunner() | 164 SingleThreadTaskGraphRunner() { |
| 168 : worker_thread_( | 165 Start("CompositorTileWorker1", |
| 169 this, | 166 base::SimpleThread::Options(base::ThreadPriority::BACKGROUND)); |
| 170 "CompositorTileWorker1", | |
| 171 base::SimpleThread::Options(base::ThreadPriority::BACKGROUND)) { | |
| 172 worker_thread_.Start(); | |
| 173 } | 167 } |
| 174 | 168 |
| 175 ~SingleThreadTaskGraphRunner() override { | 169 ~SingleThreadTaskGraphRunner() override { |
| 176 Shutdown(); | 170 Shutdown(); |
| 177 worker_thread_.Join(); | |
| 178 } | 171 } |
| 179 | |
| 180 private: | |
| 181 // Overridden from base::DelegateSimpleThread::Delegate: | |
| 182 void Run() override { cc::TaskGraphRunner::Run(); } | |
| 183 | |
| 184 base::DelegateSimpleThread worker_thread_; | |
| 185 }; | 172 }; |
| 186 | 173 |
| 187 base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner = | 174 base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner = |
| 188 LAZY_INSTANCE_INITIALIZER; | 175 LAZY_INSTANCE_INITIALIZER; |
| 189 | 176 |
| 190 } // anonymous namespace | 177 } // anonymous namespace |
| 191 | 178 |
| 192 // static | 179 // static |
| 193 Compositor* Compositor::Create(CompositorClient* client, | 180 Compositor* Compositor::Create(CompositorClient* client, |
| 194 gfx::NativeWindow root_window) { | 181 gfx::NativeWindow root_window) { |
| 195 return client ? new CompositorImpl(client, root_window) : NULL; | 182 return client ? new CompositorImpl(client, root_window) : NULL; |
| 196 } | 183 } |
| 197 | 184 |
| 198 // static | 185 // static |
| 199 void Compositor::Initialize() { | 186 void Compositor::Initialize() { |
| 200 DCHECK(!CompositorImpl::IsInitialized()); | 187 DCHECK(!CompositorImpl::IsInitialized()); |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 794 |
| 808 void CompositorImpl::SetNeedsAnimate() { | 795 void CompositorImpl::SetNeedsAnimate() { |
| 809 needs_animate_ = true; | 796 needs_animate_ = true; |
| 810 if (!host_->visible()) | 797 if (!host_->visible()) |
| 811 return; | 798 return; |
| 812 | 799 |
| 813 host_->SetNeedsAnimate(); | 800 host_->SetNeedsAnimate(); |
| 814 } | 801 } |
| 815 | 802 |
| 816 } // namespace content | 803 } // namespace content |
| OLD | NEW |