OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } | 508 } |
509 | 509 |
510 bool RenderWidgetCompositor::SendMessageToMicroBenchmark( | 510 bool RenderWidgetCompositor::SendMessageToMicroBenchmark( |
511 int id, | 511 int id, |
512 scoped_ptr<base::Value> value) { | 512 scoped_ptr<base::Value> value) { |
513 return layer_tree_host_->SendMessageToMicroBenchmark(id, value.Pass()); | 513 return layer_tree_host_->SendMessageToMicroBenchmark(id, value.Pass()); |
514 } | 514 } |
515 | 515 |
516 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { | 516 void RenderWidgetCompositor::Initialize(cc::LayerTreeSettings settings) { |
517 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy; | 517 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy; |
| 518 scoped_refptr<base::SingleThreadTaskRunner> |
| 519 main_thread_compositor_task_runner(base::MessageLoopProxy::current()); |
518 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 520 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
519 cc::SharedBitmapManager* shared_bitmap_manager = NULL; | 521 cc::SharedBitmapManager* shared_bitmap_manager = NULL; |
520 // render_thread may be NULL in tests. | 522 // render_thread may be NULL in tests. |
521 if (render_thread) { | 523 if (render_thread) { |
522 compositor_message_loop_proxy = | 524 compositor_message_loop_proxy = |
523 render_thread->compositor_message_loop_proxy(); | 525 render_thread->compositor_message_loop_proxy(); |
524 shared_bitmap_manager = render_thread->shared_bitmap_manager(); | 526 shared_bitmap_manager = render_thread->shared_bitmap_manager(); |
| 527 main_thread_compositor_task_runner = |
| 528 render_thread->main_thread_compositor_task_runner(); |
525 } | 529 } |
526 if (compositor_message_loop_proxy.get()) { | 530 if (compositor_message_loop_proxy.get()) { |
527 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( | 531 layer_tree_host_ = |
528 this, | 532 cc::LayerTreeHost::CreateThreaded(this, |
529 shared_bitmap_manager, | 533 shared_bitmap_manager, |
530 settings, | 534 settings, |
531 base::MessageLoopProxy::current(), | 535 main_thread_compositor_task_runner, |
532 compositor_message_loop_proxy); | 536 compositor_message_loop_proxy); |
533 } else { | 537 } else { |
534 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( | 538 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( |
535 this, | 539 this, |
536 this, | 540 this, |
537 shared_bitmap_manager, | 541 shared_bitmap_manager, |
538 settings, | 542 settings, |
539 base::MessageLoopProxy::current()); | 543 main_thread_compositor_task_runner); |
540 } | 544 } |
541 DCHECK(layer_tree_host_); | 545 DCHECK(layer_tree_host_); |
542 } | 546 } |
543 | 547 |
544 void RenderWidgetCompositor::setSurfaceReady() { | 548 void RenderWidgetCompositor::setSurfaceReady() { |
545 // In tests without a RenderThreadImpl, don't set ready as this kicks | 549 // In tests without a RenderThreadImpl, don't set ready as this kicks |
546 // off creating output surfaces that the test can't create. | 550 // off creating output surfaces that the test can't create. |
547 if (RenderThreadImpl::current()) | 551 if (RenderThreadImpl::current()) |
548 layer_tree_host_->SetLayerTreeHostClientReady(); | 552 layer_tree_host_->SetLayerTreeHostClientReady(); |
549 } | 553 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 widget_->OnSwapBuffersAborted(); | 829 widget_->OnSwapBuffersAborted(); |
826 } | 830 } |
827 | 831 |
828 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 832 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
829 cc::ContextProvider* provider = | 833 cc::ContextProvider* provider = |
830 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 834 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
831 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 835 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
832 } | 836 } |
833 | 837 |
834 } // namespace content | 838 } // namespace content |
OLD | NEW |