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

Side by Side Diff: ui/compositor/compositor.cc

Issue 2144733005: [WIP] cc: Plumb SurfaceId from clients Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure only SurfaceFactoy and tests can update hierarchy Created 4 years, 5 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
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/compositor/compositor.h" 5 #include "ui/compositor/compositor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <deque> 10 #include <deque>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (!compositor_) 72 if (!compositor_)
73 return; 73 return;
74 compositor_->UnlockCompositor(); 74 compositor_->UnlockCompositor();
75 compositor_ = NULL; 75 compositor_ = NULL;
76 } 76 }
77 77
78 Compositor::Compositor(ui::ContextFactory* context_factory, 78 Compositor::Compositor(ui::ContextFactory* context_factory,
79 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
80 : context_factory_(context_factory), 80 : context_factory_(context_factory),
81 root_layer_(NULL), 81 root_layer_(NULL),
82 initialized_(false),
82 widget_(gfx::kNullAcceleratedWidget), 83 widget_(gfx::kNullAcceleratedWidget),
83 widget_valid_(false), 84 widget_valid_(false),
84 output_surface_requested_(false), 85 output_surface_requested_(false),
85 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), 86 surface_id_allocator_(base::WrapUnique(new cc::SurfaceIdAllocator(
87 context_factory->AllocateSurfaceClientId()))),
86 task_runner_(task_runner), 88 task_runner_(task_runner),
87 vsync_manager_(new CompositorVSyncManager()), 89 vsync_manager_(new CompositorVSyncManager()),
88 device_scale_factor_(0.0f), 90 device_scale_factor_(0.0f),
89 locks_will_time_out_(true), 91 locks_will_time_out_(true),
90 compositor_lock_(NULL), 92 compositor_lock_(NULL),
91 layer_animator_collection_(this), 93 layer_animator_collection_(this),
92 weak_ptr_factory_(this) { 94 weak_ptr_factory_(this) {
93 root_web_layer_ = cc::Layer::Create(); 95 root_web_layer_ = cc::Layer::Create();
94 96
95 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 97 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 424 }
423 425
424 void Compositor::RequestNewOutputSurface() { 426 void Compositor::RequestNewOutputSurface() {
425 DCHECK(!output_surface_requested_); 427 DCHECK(!output_surface_requested_);
426 output_surface_requested_ = true; 428 output_surface_requested_ = true;
427 if (widget_valid_) 429 if (widget_valid_)
428 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr()); 430 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr());
429 } 431 }
430 432
431 void Compositor::DidInitializeOutputSurface() { 433 void Compositor::DidInitializeOutputSurface() {
434 initialized_ = true;
435 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
436 OnCompositingInitialized(this));
432 } 437 }
433 438
434 void Compositor::DidFailToInitializeOutputSurface() { 439 void Compositor::DidFailToInitializeOutputSurface() {
435 // The OutputSurface should already be bound/initialized before being given to 440 // The OutputSurface should already be bound/initialized before being given to
436 // the Compositor. 441 // the Compositor.
437 NOTREACHED(); 442 NOTREACHED();
438 } 443 }
439 444
440 void Compositor::DidCommit() { 445 void Compositor::DidCommit() {
441 DCHECK(!IsLocked()); 446 DCHECK(!IsLocked());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 observer_list_, 505 observer_list_,
501 OnCompositingLockStateChanged(this)); 506 OnCompositingLockStateChanged(this));
502 } 507 }
503 508
504 void Compositor::CancelCompositorLock() { 509 void Compositor::CancelCompositorLock() {
505 if (compositor_lock_) 510 if (compositor_lock_)
506 compositor_lock_->CancelLock(); 511 compositor_lock_->CancelLock();
507 } 512 }
508 513
509 } // namespace ui 514 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/compositor_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698