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

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

Issue 11293121: Add latency measurement system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: create cc::LatencyInfo Created 7 years, 11 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 | Annotate | Revision Log
« 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 <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 Compositor::Compositor(CompositorDelegate* delegate, 297 Compositor::Compositor(CompositorDelegate* delegate,
298 gfx::AcceleratedWidget widget) 298 gfx::AcceleratedWidget widget)
299 : delegate_(delegate), 299 : delegate_(delegate),
300 root_layer_(NULL), 300 root_layer_(NULL),
301 widget_(widget), 301 widget_(widget),
302 posted_swaps_(new PostedSwapQueue()), 302 posted_swaps_(new PostedSwapQueue()),
303 device_scale_factor_(0.0f), 303 device_scale_factor_(0.0f),
304 last_started_frame_(0), 304 last_started_frame_(0),
305 last_ended_frame_(0), 305 last_ended_frame_(0),
306 frame_number_(0),
306 disable_schedule_composite_(false), 307 disable_schedule_composite_(false),
307 compositor_lock_(NULL) { 308 compositor_lock_(NULL) {
308 root_web_layer_ = cc::Layer::create(); 309 root_web_layer_ = cc::Layer::create();
309 root_web_layer_->setAnchorPoint(gfx::PointF(0.f, 0.f)); 310 root_web_layer_->setAnchorPoint(gfx::PointF(0.f, 0.f));
310 311
311 CommandLine* command_line = CommandLine::ForCurrentProcess(); 312 CommandLine* command_line = CommandLine::ForCurrentProcess();
312 cc::LayerTreeSettings settings; 313 cc::LayerTreeSettings settings;
313 settings.initialDebugState.showFPSCounter = 314 settings.initialDebugState.showFPSCounter =
314 command_line->HasSwitch(switches::kUIShowFPSCounter); 315 command_line->HasSwitch(switches::kUIShowFPSCounter);
315 settings.initialDebugState.showPlatformLayerTree = 316 settings.initialDebugState.showPlatformLayerTree =
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 FOR_EACH_OBSERVER(CompositorObserver, 541 FOR_EACH_OBSERVER(CompositorObserver,
541 observer_list_, 542 observer_list_,
542 OnCompositingStarted(this)); 543 OnCompositingStarted(this));
543 } 544 }
544 545
545 void Compositor::didCompleteSwapBuffers() { 546 void Compositor::didCompleteSwapBuffers() {
546 DCHECK(g_compositor_thread); 547 DCHECK(g_compositor_thread);
547 NotifyEnd(); 548 NotifyEnd();
548 } 549 }
549 550
551 void Compositor::onReceivedLatencyInfo(
552 const cc::LatencyInfo& latencyInfo) {
553 FOR_EACH_OBSERVER(CompositorObserver,
554 observer_list_,
555 OnReceivedLatencyInfo(this, latencyInfo));
556 }
557
558 int64 Compositor::SetInputNumber(int64 input_number) {
559 cc::LatencyInfo browser_latency_info;
560 browser_latency_info.rendererMainFrameNumber = ++frame_number_;
561 browser_latency_info.inputNumber = input_number;
562 host_->setLatencyInfo(browser_latency_info);
563 return frame_number_;
564 }
565
550 void Compositor::scheduleComposite() { 566 void Compositor::scheduleComposite() {
551 if (!disable_schedule_composite_) 567 if (!disable_schedule_composite_)
552 ScheduleDraw(); 568 ScheduleDraw();
553 } 569 }
554 570
555 scoped_ptr<cc::FontAtlas> Compositor::createFontAtlas() { 571 scoped_ptr<cc::FontAtlas> Compositor::createFontAtlas() {
556 return scoped_ptr<cc::FontAtlas>(); 572 return scoped_ptr<cc::FontAtlas>();
557 } 573 }
558 574
559 scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { 575 scoped_refptr<CompositorLock> Compositor::GetCompositorLock() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 621
606 COMPOSITOR_EXPORT void DisableTestCompositor() { 622 COMPOSITOR_EXPORT void DisableTestCompositor() {
607 test_compositor_enabled = false; 623 test_compositor_enabled = false;
608 } 624 }
609 625
610 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { 626 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() {
611 return test_compositor_enabled; 627 return test_compositor_enabled;
612 } 628 }
613 629
614 } // namespace ui 630 } // 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