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

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

Issue 2582653002: ui::Compositor needs a valid FrameSinkId even when it doesn't have ContextFactoryPrivate. (Closed)
Patch Set: Adding const, comments. Created 4 years 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 | « no previous file | no next file » | 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 28 matching lines...) Expand all
39 #include "ui/compositor/dip_util.h" 39 #include "ui/compositor/dip_util.h"
40 #include "ui/compositor/layer.h" 40 #include "ui/compositor/layer.h"
41 #include "ui/compositor/layer_animator_collection.h" 41 #include "ui/compositor/layer_animator_collection.h"
42 #include "ui/gl/gl_switches.h" 42 #include "ui/gl/gl_switches.h"
43 43
44 namespace { 44 namespace {
45 45
46 const double kDefaultRefreshRate = 60.0; 46 const double kDefaultRefreshRate = 60.0;
47 const double kTestRefreshRate = 200.0; 47 const double kTestRefreshRate = 200.0;
48 48
49 // TODO(mfomitchev, fsamuel): Looks at removing this when transition from
sadrul 2016/12/16 20:17:28 *Look
mfomitchev 2016/12/16 20:49:45 Done.
50 // SurfaceSequence to SurfaceReference is fully complete.
51 // Used when ui::Compositor is created with null ContextFactoryPrivate.
52 // Compositor needs a valid FrameSinkId, so that cc::SurfaceLayer can create
53 // valid SurfaceSequences.
54 constexpr cc::FrameSinkId kDefaultFrameSinkId(1, 1);
55
49 } // namespace 56 } // namespace
50 57
51 namespace ui { 58 namespace ui {
52 59
53 CompositorLock::CompositorLock(Compositor* compositor) 60 CompositorLock::CompositorLock(Compositor* compositor)
54 : compositor_(compositor) { 61 : compositor_(compositor) {
55 if (compositor_->locks_will_time_out_) { 62 if (compositor_->locks_will_time_out_) {
56 compositor_->task_runner_->PostDelayedTask( 63 compositor_->task_runner_->PostDelayedTask(
57 FROM_HERE, 64 FROM_HERE,
58 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()), 65 base::Bind(&CompositorLock::CancelLock, AsWeakPtr()),
(...skipping 19 matching lines...) Expand all
78 context_factory_private_(context_factory_private), 85 context_factory_private_(context_factory_private),
79 root_layer_(NULL), 86 root_layer_(NULL),
80 widget_(gfx::kNullAcceleratedWidget), 87 widget_(gfx::kNullAcceleratedWidget),
81 #if defined(USE_AURA) 88 #if defined(USE_AURA)
82 window_(nullptr), 89 window_(nullptr),
83 #endif 90 #endif
84 widget_valid_(false), 91 widget_valid_(false),
85 compositor_frame_sink_requested_(false), 92 compositor_frame_sink_requested_(false),
86 frame_sink_id_(context_factory_private 93 frame_sink_id_(context_factory_private
87 ? context_factory_private->AllocateFrameSinkId() 94 ? context_factory_private->AllocateFrameSinkId()
88 : cc::FrameSinkId()), 95 : kDefaultFrameSinkId),
89 task_runner_(task_runner), 96 task_runner_(task_runner),
90 vsync_manager_(new CompositorVSyncManager()), 97 vsync_manager_(new CompositorVSyncManager()),
91 device_scale_factor_(0.0f), 98 device_scale_factor_(0.0f),
92 locks_will_time_out_(true), 99 locks_will_time_out_(true),
93 compositor_lock_(NULL), 100 compositor_lock_(NULL),
94 layer_animator_collection_(this), 101 layer_animator_collection_(this),
95 weak_ptr_factory_(this) { 102 weak_ptr_factory_(this) {
96 if (context_factory_private) { 103 if (context_factory_private) {
97 context_factory_private->GetSurfaceManager()->RegisterFrameSinkId( 104 context_factory_private->GetSurfaceManager()->RegisterFrameSinkId(
98 frame_sink_id_); 105 frame_sink_id_);
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 for (auto& observer : observer_list_) 565 for (auto& observer : observer_list_)
559 observer.OnCompositingLockStateChanged(this); 566 observer.OnCompositingLockStateChanged(this);
560 } 567 }
561 568
562 void Compositor::CancelCompositorLock() { 569 void Compositor::CancelCompositorLock() {
563 if (compositor_lock_) 570 if (compositor_lock_)
564 compositor_lock_->CancelLock(); 571 compositor_lock_->CancelLock();
565 } 572 }
566 573
567 } // namespace ui 574 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698