Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 1747783002: CC Animation: Erase old animation system in Android Compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <stdint.h> 9 #include <stdint.h>
10 #include <utility> 10 #include <utility>
(...skipping 11 matching lines...) Expand all
22 #include "base/single_thread_task_runner.h" 22 #include "base/single_thread_task_runner.h"
23 #include "base/synchronization/lock.h" 23 #include "base/synchronization/lock.h"
24 #include "base/sys_info.h" 24 #include "base/sys_info.h"
25 #include "base/thread_task_runner_handle.h" 25 #include "base/thread_task_runner_handle.h"
26 #include "base/threading/simple_thread.h" 26 #include "base/threading/simple_thread.h"
27 #include "base/threading/thread.h" 27 #include "base/threading/thread.h"
28 #include "base/threading/thread_checker.h" 28 #include "base/threading/thread_checker.h"
29 #include "cc/base/switches.h" 29 #include "cc/base/switches.h"
30 #include "cc/input/input_handler.h" 30 #include "cc/input/input_handler.h"
31 #include "cc/layers/layer.h" 31 #include "cc/layers/layer.h"
32 #include "cc/layers/layer_settings.h"
32 #include "cc/output/compositor_frame.h" 33 #include "cc/output/compositor_frame.h"
33 #include "cc/output/context_provider.h" 34 #include "cc/output/context_provider.h"
34 #include "cc/output/output_surface.h" 35 #include "cc/output/output_surface.h"
35 #include "cc/output/output_surface_client.h" 36 #include "cc/output/output_surface_client.h"
36 #include "cc/raster/single_thread_task_graph_runner.h" 37 #include "cc/raster/single_thread_task_graph_runner.h"
37 #include "cc/scheduler/begin_frame_source.h" 38 #include "cc/scheduler/begin_frame_source.h"
38 #include "cc/surfaces/onscreen_display_client.h" 39 #include "cc/surfaces/onscreen_display_client.h"
39 #include "cc/surfaces/surface_display_output_surface.h" 40 #include "cc/surfaces/surface_display_output_surface.h"
40 #include "cc/surfaces/surface_id_allocator.h" 41 #include "cc/surfaces/surface_id_allocator.h"
41 #include "cc/surfaces/surface_manager.h" 42 #include "cc/surfaces/surface_manager.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return client ? new CompositorImpl(client, root_window) : NULL; 215 return client ? new CompositorImpl(client, root_window) : NULL;
215 } 216 }
216 217
217 // static 218 // static
218 void Compositor::Initialize() { 219 void Compositor::Initialize() {
219 DCHECK(!CompositorImpl::IsInitialized()); 220 DCHECK(!CompositorImpl::IsInitialized());
220 g_initialized = true; 221 g_initialized = true;
221 } 222 }
222 223
223 // static 224 // static
224 const cc::LayerSettings& Compositor::LayerSettings() {
225 return ui::WindowAndroidCompositor::LayerSettings();
226 }
227
228 // static
229 void Compositor::SetLayerSettings(const cc::LayerSettings& settings) {
230 ui::WindowAndroidCompositor::SetLayerSettings(settings);
231 }
232
233 // static
234 bool CompositorImpl::IsInitialized() { 225 bool CompositorImpl::IsInitialized() {
235 return g_initialized; 226 return g_initialized;
236 } 227 }
237 228
238 // static 229 // static
239 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() { 230 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() {
240 return g_surface_manager.Pointer(); 231 return g_surface_manager.Pointer();
241 } 232 }
242 233
243 // static 234 // static
244 scoped_ptr<cc::SurfaceIdAllocator> CompositorImpl::CreateSurfaceIdAllocator() { 235 scoped_ptr<cc::SurfaceIdAllocator> CompositorImpl::CreateSurfaceIdAllocator() {
245 scoped_ptr<cc::SurfaceIdAllocator> allocator( 236 scoped_ptr<cc::SurfaceIdAllocator> allocator(
246 new cc::SurfaceIdAllocator(++g_surface_id_namespace)); 237 new cc::SurfaceIdAllocator(++g_surface_id_namespace));
247 cc::SurfaceManager* manager = GetSurfaceManager(); 238 cc::SurfaceManager* manager = GetSurfaceManager();
248 DCHECK(manager); 239 DCHECK(manager);
249 allocator->RegisterSurfaceIdNamespace(manager); 240 allocator->RegisterSurfaceIdNamespace(manager);
250 return allocator; 241 return allocator;
251 } 242 }
252 243
253 CompositorImpl::CompositorImpl(CompositorClient* client, 244 CompositorImpl::CompositorImpl(CompositorClient* client,
254 gfx::NativeWindow root_window) 245 gfx::NativeWindow root_window)
255 : root_layer_(cc::Layer::Create(Compositor::LayerSettings())), 246 : root_layer_(cc::Layer::Create(cc::LayerSettings())),
256 resource_manager_(root_window), 247 resource_manager_(root_window),
257 surface_id_allocator_(CreateSurfaceIdAllocator()), 248 surface_id_allocator_(CreateSurfaceIdAllocator()),
258 has_transparent_background_(false), 249 has_transparent_background_(false),
259 device_scale_factor_(1), 250 device_scale_factor_(1),
260 window_(NULL), 251 window_(NULL),
261 surface_id_(0), 252 surface_id_(0),
262 client_(client), 253 client_(client),
263 root_window_(root_window), 254 root_window_(root_window),
264 needs_animate_(false), 255 needs_animate_(false),
265 pending_swapbuffers_(0U), 256 pending_swapbuffers_(0U),
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 settings.use_zero_copy = true; 339 settings.use_zero_copy = true;
349 settings.use_external_begin_frame_source = true; 340 settings.use_external_begin_frame_source = true;
350 341
351 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 342 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
352 settings.initial_debug_state.SetRecordRenderingStats( 343 settings.initial_debug_state.SetRecordRenderingStats(
353 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); 344 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking));
354 settings.initial_debug_state.show_fps_counter = 345 settings.initial_debug_state.show_fps_counter =
355 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); 346 command_line->HasSwitch(cc::switches::kUIShowFPSCounter);
356 settings.single_thread_proxy_scheduler = true; 347 settings.single_thread_proxy_scheduler = true;
357 348
358 settings.use_compositor_animation_timelines = !command_line->HasSwitch(
359 switches::kDisableAndroidCompositorAnimationTimelines);
360
361 cc::LayerTreeHost::InitParams params; 349 cc::LayerTreeHost::InitParams params;
362 params.client = this; 350 params.client = this;
363 params.shared_bitmap_manager = HostSharedBitmapManager::current(); 351 params.shared_bitmap_manager = HostSharedBitmapManager::current();
364 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); 352 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current();
365 params.task_graph_runner = g_task_graph_runner.Pointer(); 353 params.task_graph_runner = g_task_graph_runner.Pointer();
366 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 354 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
367 params.settings = &settings; 355 params.settings = &settings;
368 params.external_begin_frame_source.reset(new ExternalBeginFrameSource(this)); 356 params.external_begin_frame_source.reset(new ExternalBeginFrameSource(this));
369 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params); 357 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
370 DCHECK(!host_->visible()); 358 DCHECK(!host_->visible());
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 628
641 void CompositorImpl::SetNeedsAnimate() { 629 void CompositorImpl::SetNeedsAnimate() {
642 needs_animate_ = true; 630 needs_animate_ = true;
643 if (!host_->visible()) 631 if (!host_->visible())
644 return; 632 return;
645 633
646 host_->SetNeedsAnimate(); 634 host_->SetNeedsAnimate();
647 } 635 }
648 636
649 } // namespace content 637 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698