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()); | |
520 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 518 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
521 cc::SharedBitmapManager* shared_bitmap_manager = NULL; | 519 cc::SharedBitmapManager* shared_bitmap_manager = NULL; |
522 // render_thread may be NULL in tests. | 520 // render_thread may be NULL in tests. |
523 if (render_thread) { | 521 if (render_thread) { |
524 compositor_message_loop_proxy = | 522 compositor_message_loop_proxy = |
525 render_thread->compositor_message_loop_proxy(); | 523 render_thread->compositor_message_loop_proxy(); |
526 shared_bitmap_manager = render_thread->shared_bitmap_manager(); | 524 shared_bitmap_manager = render_thread->shared_bitmap_manager(); |
527 main_thread_compositor_task_runner = | |
528 render_thread->main_thread_compositor_task_runner(); | |
529 } | 525 } |
530 if (compositor_message_loop_proxy.get()) { | 526 if (compositor_message_loop_proxy.get()) { |
531 layer_tree_host_ = | 527 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( |
532 cc::LayerTreeHost::CreateThreaded(this, | 528 this, |
533 shared_bitmap_manager, | 529 shared_bitmap_manager, |
534 settings, | 530 settings, |
535 main_thread_compositor_task_runner, | 531 base::MessageLoopProxy::current(), |
536 compositor_message_loop_proxy); | 532 compositor_message_loop_proxy); |
537 } else { | 533 } else { |
538 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( | 534 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded( |
539 this, | 535 this, |
540 this, | 536 this, |
541 shared_bitmap_manager, | 537 shared_bitmap_manager, |
542 settings, | 538 settings, |
543 main_thread_compositor_task_runner); | 539 base::MessageLoopProxy::current()); |
544 } | 540 } |
545 DCHECK(layer_tree_host_); | 541 DCHECK(layer_tree_host_); |
546 } | 542 } |
547 | 543 |
548 void RenderWidgetCompositor::setSurfaceReady() { | 544 void RenderWidgetCompositor::setSurfaceReady() { |
549 // In tests without a RenderThreadImpl, don't set ready as this kicks | 545 // In tests without a RenderThreadImpl, don't set ready as this kicks |
550 // off creating output surfaces that the test can't create. | 546 // off creating output surfaces that the test can't create. |
551 if (RenderThreadImpl::current()) | 547 if (RenderThreadImpl::current()) |
552 layer_tree_host_->SetLayerTreeHostClientReady(); | 548 layer_tree_host_->SetLayerTreeHostClientReady(); |
553 } | 549 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 widget_->OnSwapBuffersAborted(); | 825 widget_->OnSwapBuffersAborted(); |
830 } | 826 } |
831 | 827 |
832 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 828 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
833 cc::ContextProvider* provider = | 829 cc::ContextProvider* provider = |
834 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 830 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
835 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 831 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
836 } | 832 } |
837 | 833 |
838 } // namespace content | 834 } // namespace content |
OLD | NEW |