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

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

Issue 943763004: cc: Remove the unused compositor thread variable and interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compositorthread: build Created 5 years, 10 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/test/in_process_context_factory.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 <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 compositor_ = NULL; 65 compositor_ = NULL;
66 } 66 }
67 67
68 Compositor::Compositor(gfx::AcceleratedWidget widget, 68 Compositor::Compositor(gfx::AcceleratedWidget widget,
69 ui::ContextFactory* context_factory, 69 ui::ContextFactory* context_factory,
70 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 70 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
71 : context_factory_(context_factory), 71 : context_factory_(context_factory),
72 root_layer_(NULL), 72 root_layer_(NULL),
73 widget_(widget), 73 widget_(widget),
74 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), 74 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()),
75 compositor_thread_loop_(context_factory->GetCompositorMessageLoop()),
76 task_runner_(task_runner), 75 task_runner_(task_runner),
77 vsync_manager_(new CompositorVSyncManager()), 76 vsync_manager_(new CompositorVSyncManager()),
78 device_scale_factor_(0.0f), 77 device_scale_factor_(0.0f),
79 last_started_frame_(0), 78 last_started_frame_(0),
80 last_ended_frame_(0), 79 last_ended_frame_(0),
81 num_failed_recreate_attempts_(0), 80 num_failed_recreate_attempts_(0),
82 disable_schedule_composite_(false), 81 disable_schedule_composite_(false),
83 compositor_lock_(NULL), 82 compositor_lock_(NULL),
84 layer_animator_collection_(this), 83 layer_animator_collection_(this),
85 weak_ptr_factory_(this) { 84 weak_ptr_factory_(this) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); 129 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects);
131 130
132 settings.initial_debug_state.SetRecordRenderingStats( 131 settings.initial_debug_state.SetRecordRenderingStats(
133 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); 132 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking));
134 133
135 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); 134 settings.impl_side_painting = IsUIImplSidePaintingEnabled();
136 settings.use_zero_copy = IsUIZeroCopyEnabled(); 135 settings.use_zero_copy = IsUIZeroCopyEnabled();
137 settings.hud_typeface = ui::GetHudTypeface(); 136 settings.hud_typeface = ui::GetHudTypeface();
138 137
139 base::TimeTicks before_create = base::TimeTicks::Now(); 138 base::TimeTicks before_create = base::TimeTicks::Now();
140 if (compositor_thread_loop_.get()) { 139 host_ = cc::LayerTreeHost::CreateSingleThreaded(
141 host_ = cc::LayerTreeHost::CreateThreaded( 140 this, this, context_factory_->GetSharedBitmapManager(),
142 this, 141 context_factory_->GetGpuMemoryBufferManager(), settings, task_runner_,
143 context_factory_->GetSharedBitmapManager(), 142 nullptr);
144 context_factory_->GetGpuMemoryBufferManager(),
145 settings,
146 task_runner_,
147 compositor_thread_loop_,
148 nullptr);
149 } else {
150 host_ = cc::LayerTreeHost::CreateSingleThreaded(
151 this,
152 this,
153 context_factory_->GetSharedBitmapManager(),
154 context_factory_->GetGpuMemoryBufferManager(),
155 settings,
156 task_runner_,
157 nullptr);
158 }
159 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", 143 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
160 base::TimeTicks::Now() - before_create); 144 base::TimeTicks::Now() - before_create);
161 host_->SetRootLayer(root_web_layer_); 145 host_->SetRootLayer(root_web_layer_);
162 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace()); 146 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace());
163 host_->SetLayerTreeHostClientReady(); 147 host_->SetLayerTreeHostClientReady();
164 } 148 }
165 149
166 Compositor::~Compositor() { 150 Compositor::~Compositor() {
167 TRACE_EVENT0("shutdown", "Compositor::destructor"); 151 TRACE_EVENT0("shutdown", "Compositor::destructor");
168 152
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 DCHECK(!IsLocked()); 331 DCHECK(!IsLocked());
348 FOR_EACH_OBSERVER(CompositorObserver, 332 FOR_EACH_OBSERVER(CompositorObserver,
349 observer_list_, 333 observer_list_,
350 OnCompositingDidCommit(this)); 334 OnCompositingDidCommit(this));
351 } 335 }
352 336
353 void Compositor::DidCommitAndDrawFrame() { 337 void Compositor::DidCommitAndDrawFrame() {
354 } 338 }
355 339
356 void Compositor::DidCompleteSwapBuffers() { 340 void Compositor::DidCompleteSwapBuffers() {
357 // DidPostSwapBuffers is a SingleThreadProxy-only feature. Synthetically
358 // generate OnCompositingStarted messages for the threaded case so that
359 // OnCompositingStarted/OnCompositingEnded messages match.
360 if (compositor_thread_loop_.get()) {
361 base::TimeTicks start_time = gfx::FrameTime::Now();
362 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
363 OnCompositingStarted(this, start_time));
364 }
365 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 341 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
366 OnCompositingEnded(this)); 342 OnCompositingEnded(this));
367 } 343 }
368 344
369 void Compositor::DidPostSwapBuffers() { 345 void Compositor::DidPostSwapBuffers() {
370 base::TimeTicks start_time = gfx::FrameTime::Now(); 346 base::TimeTicks start_time = gfx::FrameTime::Now();
371 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 347 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
372 OnCompositingStarted(this, start_time)); 348 OnCompositingStarted(this, start_time));
373 } 349 }
374 350
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 observer_list_, 386 observer_list_,
411 OnCompositingLockStateChanged(this)); 387 OnCompositingLockStateChanged(this));
412 } 388 }
413 389
414 void Compositor::CancelCompositorLock() { 390 void Compositor::CancelCompositorLock() {
415 if (compositor_lock_) 391 if (compositor_lock_)
416 compositor_lock_->CancelLock(); 392 compositor_lock_->CancelLock();
417 } 393 }
418 394
419 } // namespace ui 395 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698