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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « ui/base/x/x11_foreign_window_manager.h ('k') | ui/compositor/layer_tree_owner.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 waiting_on_compositing_end_(false), 107 waiting_on_compositing_end_(false),
108 draw_on_compositing_end_(false), 108 draw_on_compositing_end_(false),
109 swap_state_(SWAP_NONE), 109 swap_state_(SWAP_NONE),
110 layer_animator_collection_(this), 110 layer_animator_collection_(this),
111 schedule_draw_factory_(this) { 111 schedule_draw_factory_(this) {
112 root_web_layer_ = cc::Layer::Create(); 112 root_web_layer_ = cc::Layer::Create();
113 113
114 CommandLine* command_line = CommandLine::ForCurrentProcess(); 114 CommandLine* command_line = CommandLine::ForCurrentProcess();
115 115
116 cc::LayerTreeSettings settings; 116 cc::LayerTreeSettings settings;
117 settings.refresh_rate = 117 settings.renderer_settings.refresh_rate =
118 context_factory_->DoesCreateTestContexts() 118 context_factory_->DoesCreateTestContexts()
119 ? kTestRefreshRate 119 ? kTestRefreshRate
120 : kDefaultRefreshRate; 120 : kDefaultRefreshRate;
121 settings.main_frame_before_activation_enabled = false; 121 settings.main_frame_before_activation_enabled = false;
122 settings.throttle_frame_production = 122 settings.throttle_frame_production =
123 !command_line->HasSwitch(switches::kDisableGpuVsync); 123 !command_line->HasSwitch(switches::kDisableGpuVsync);
124 #if !defined(OS_MACOSX) 124 #if !defined(OS_MACOSX)
125 settings.partial_swap_enabled = 125 settings.renderer_settings.partial_swap_enabled =
126 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); 126 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap);
127 #endif 127 #endif
128 #if defined(OS_CHROMEOS) 128 #if defined(OS_CHROMEOS)
129 settings.per_tile_painting_enabled = true; 129 settings.per_tile_painting_enabled = true;
130 #endif 130 #endif
131 #if defined(OS_WIN) 131 #if defined(OS_WIN)
132 settings.disable_hi_res_timer_tasks_on_battery = true; 132 settings.disable_hi_res_timer_tasks_on_battery = true;
133 #endif 133 #endif
134 134
135 // These flags should be mirrored by renderer versions in content/renderer/. 135 // These flags should be mirrored by renderer versions in content/renderer/.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1); 246 TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1);
247 247
248 DCHECK_NE(swap_state_, SWAP_POSTED); 248 DCHECK_NE(swap_state_, SWAP_POSTED);
249 swap_state_ = SWAP_NONE; 249 swap_state_ = SWAP_NONE;
250 250
251 waiting_on_compositing_end_ = true; 251 waiting_on_compositing_end_ = true;
252 last_started_frame_++; 252 last_started_frame_++;
253 if (!IsLocked()) { 253 if (!IsLocked()) {
254 // TODO(nduca): Temporary while compositor calls 254 // TODO(nduca): Temporary while compositor calls
255 // compositeImmediately() directly. 255 // compositeImmediately() directly.
256 cc::BeginFrameArgs args = 256 cc::BeginFrameArgs args = cc::BeginFrameArgs::Create(
257 cc::BeginFrameArgs::Create(gfx::FrameTime::Now(), 257 gfx::FrameTime::Now(), base::TimeTicks(),
258 base::TimeTicks(), 258 cc::BeginFrameArgs::DefaultInterval(), cc::BeginFrameArgs::SYNCHRONOUS);
259 cc::BeginFrameArgs::DefaultInterval());
260 BeginMainFrame(args); 259 BeginMainFrame(args);
261 host_->Composite(args.frame_time); 260 host_->Composite(args.frame_time);
262 } 261 }
263 if (swap_state_ == SWAP_NONE) 262 if (swap_state_ == SWAP_NONE)
264 NotifyEnd(); 263 NotifyEnd();
265 } 264 }
266 265
267 void Compositor::ScheduleFullRedraw() { 266 void Compositor::ScheduleFullRedraw() {
268 host_->SetNeedsRedraw(); 267 host_->SetNeedsRedraw();
269 } 268 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // Call ScheduleDraw() instead of Draw() in order to allow other 480 // Call ScheduleDraw() instead of Draw() in order to allow other
482 // CompositorObservers to be notified before starting another 481 // CompositorObservers to be notified before starting another
483 // draw cycle. 482 // draw cycle.
484 ScheduleDraw(); 483 ScheduleDraw();
485 } 484 }
486 FOR_EACH_OBSERVER( 485 FOR_EACH_OBSERVER(
487 CompositorObserver, observer_list_, OnCompositingEnded(this)); 486 CompositorObserver, observer_list_, OnCompositingEnded(this));
488 } 487 }
489 488
490 } // namespace ui 489 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/x/x11_foreign_window_manager.h ('k') | ui/compositor/layer_tree_owner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698