OLD | NEW |
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 Compositor::Compositor(CompositorDelegate* delegate, | 292 Compositor::Compositor(CompositorDelegate* delegate, |
293 gfx::AcceleratedWidget widget) | 293 gfx::AcceleratedWidget widget) |
294 : delegate_(delegate), | 294 : delegate_(delegate), |
295 root_layer_(NULL), | 295 root_layer_(NULL), |
296 widget_(widget), | 296 widget_(widget), |
297 posted_swaps_(new PostedSwapQueue()), | 297 posted_swaps_(new PostedSwapQueue()), |
298 device_scale_factor_(0.0f), | 298 device_scale_factor_(0.0f), |
299 last_started_frame_(0), | 299 last_started_frame_(0), |
300 last_ended_frame_(0), | 300 last_ended_frame_(0), |
| 301 frame_number_(0), |
301 disable_schedule_composite_(false), | 302 disable_schedule_composite_(false), |
302 compositor_lock_(NULL) { | 303 compositor_lock_(NULL) { |
303 root_web_layer_ = cc::Layer::create(); | 304 root_web_layer_ = cc::Layer::create(); |
304 root_web_layer_->setAnchorPoint(gfx::PointF(0.f, 0.f)); | 305 root_web_layer_->setAnchorPoint(gfx::PointF(0.f, 0.f)); |
305 | 306 |
306 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 307 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
307 cc::LayerTreeSettings settings; | 308 cc::LayerTreeSettings settings; |
308 settings.initialDebugState.showFPSCounter = | 309 settings.initialDebugState.showFPSCounter = |
309 command_line->HasSwitch(switches::kUIShowFPSCounter); | 310 command_line->HasSwitch(switches::kUIShowFPSCounter); |
310 settings.initialDebugState.showPlatformLayerTree = | 311 settings.initialDebugState.showPlatformLayerTree = |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 FOR_EACH_OBSERVER(CompositorObserver, | 536 FOR_EACH_OBSERVER(CompositorObserver, |
536 observer_list_, | 537 observer_list_, |
537 OnCompositingStarted(this)); | 538 OnCompositingStarted(this)); |
538 } | 539 } |
539 | 540 |
540 void Compositor::didCompleteSwapBuffers() { | 541 void Compositor::didCompleteSwapBuffers() { |
541 DCHECK(g_compositor_thread); | 542 DCHECK(g_compositor_thread); |
542 NotifyEnd(); | 543 NotifyEnd(); |
543 } | 544 } |
544 | 545 |
| 546 void Compositor::onReceivedLatencyInfo( |
| 547 const WebKit::WebLatencyInfoImpl& latencyInfo) { |
| 548 FOR_EACH_OBSERVER(CompositorObserver, |
| 549 observer_list_, |
| 550 OnReceivedLatencyInfo(this, latencyInfo)); |
| 551 } |
| 552 |
| 553 int64 Compositor::SetInputNumber(int64 input_number) { |
| 554 WebKit::WebLatencyInfoImpl browser_latency_info; |
| 555 browser_latency_info.rendererMainFrameNumber = ++frame_number_; |
| 556 browser_latency_info.inputNumber = input_number; |
| 557 host_->setLatencyInfo(browser_latency_info); |
| 558 return frame_number_; |
| 559 } |
| 560 |
545 void Compositor::scheduleComposite() { | 561 void Compositor::scheduleComposite() { |
546 if (!disable_schedule_composite_) | 562 if (!disable_schedule_composite_) |
547 ScheduleDraw(); | 563 ScheduleDraw(); |
548 } | 564 } |
549 | 565 |
550 scoped_ptr<cc::FontAtlas> Compositor::createFontAtlas() { | 566 scoped_ptr<cc::FontAtlas> Compositor::createFontAtlas() { |
551 return scoped_ptr<cc::FontAtlas>(); | 567 return scoped_ptr<cc::FontAtlas>(); |
552 } | 568 } |
553 | 569 |
554 scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { | 570 scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 616 |
601 COMPOSITOR_EXPORT void DisableTestCompositor() { | 617 COMPOSITOR_EXPORT void DisableTestCompositor() { |
602 test_compositor_enabled = false; | 618 test_compositor_enabled = false; |
603 } | 619 } |
604 | 620 |
605 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 621 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
606 return test_compositor_enabled; | 622 return test_compositor_enabled; |
607 } | 623 } |
608 | 624 |
609 } // namespace ui | 625 } // namespace ui |
OLD | NEW |