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

Side by Side Diff: content/renderer/render_widget.cc

Issue 1769913003: sync compositor: Add output_surface_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittests compile Created 4 years, 9 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
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 "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 CreateGraphicsContext3D(gpu_channel_host.get()), 740 CreateGraphicsContext3D(gpu_channel_host.get()),
741 RENDER_COMPOSITOR_CONTEXT); 741 RENDER_COMPOSITOR_CONTEXT);
742 DCHECK(context_provider); 742 DCHECK(context_provider);
743 worker_context_provider = 743 worker_context_provider =
744 RenderThreadImpl::current()->SharedWorkerContextProvider(); 744 RenderThreadImpl::current()->SharedWorkerContextProvider();
745 if (!worker_context_provider) { 745 if (!worker_context_provider) {
746 // Cause the compositor to wait and try again. 746 // Cause the compositor to wait and try again.
747 return nullptr; 747 return nullptr;
748 } 748 }
749 749
750 uint32_t output_surface_id = next_output_surface_id_++;
750 #if defined(OS_ANDROID) 751 #if defined(OS_ANDROID)
751 if (SynchronousCompositorFactory* factory = 752 if (SynchronousCompositorFactory* factory =
752 SynchronousCompositorFactory::GetInstance()) { 753 SynchronousCompositorFactory::GetInstance()) {
753 return factory->CreateOutputSurface( 754 return factory->CreateOutputSurface(
754 routing_id(), frame_swap_message_queue_, context_provider, 755 routing_id(), output_surface_id, frame_swap_message_queue_,
755 worker_context_provider); 756 context_provider, worker_context_provider);
756 } else if (RenderThreadImpl::current()->sync_compositor_message_filter()) { 757 } else if (RenderThreadImpl::current()->sync_compositor_message_filter()) {
757 return make_scoped_ptr(new SynchronousCompositorOutputSurface( 758 return make_scoped_ptr(new SynchronousCompositorOutputSurface(
758 context_provider, worker_context_provider, routing_id(), 759 context_provider, worker_context_provider, routing_id(),
759 content::RenderThreadImpl::current() 760 output_surface_id, content::RenderThreadImpl::current()
760 ->sync_compositor_message_filter(), 761 ->sync_compositor_message_filter(),
761 frame_swap_message_queue_)); 762 frame_swap_message_queue_));
762 } 763 }
763 #endif 764 #endif
764 } 765 }
765 766
766 uint32_t output_surface_id = next_output_surface_id_++; 767 uint32_t output_surface_id = next_output_surface_id_++;
hush (inactive) 2016/03/09 02:36:17 We can probably pull this line between 737 and 738
boliu 2016/03/09 02:39:44 That can leave gaps if context creation fails. Not
hush (inactive) 2016/03/09 20:21:49 Okay. Let's not change chrome behavior.
767 // Composite-to-mailbox is currently used for layout tests in order to cause 768 // Composite-to-mailbox is currently used for layout tests in order to cause
768 // them to draw inside in the renderer to do the readback there. This should 769 // them to draw inside in the renderer to do the readback there. This should
769 // no longer be the case when crbug.com/311404 is fixed. 770 // no longer be the case when crbug.com/311404 is fixed.
770 if (!RenderThreadImpl::current() || 771 if (!RenderThreadImpl::current() ||
771 !RenderThreadImpl::current()->layout_test_mode()) { 772 !RenderThreadImpl::current()->layout_test_mode()) {
772 DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner()); 773 DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner());
773 return make_scoped_ptr(new DelegatedCompositorOutputSurface( 774 return make_scoped_ptr(new DelegatedCompositorOutputSurface(
774 routing_id(), output_surface_id, context_provider, 775 routing_id(), output_surface_id, context_provider,
775 worker_context_provider, frame_swap_message_queue_)); 776 worker_context_provider, frame_swap_message_queue_));
776 } 777 }
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 } 2160 }
2160 2161
2161 float RenderWidget::GetOriginalDeviceScaleFactor() const { 2162 float RenderWidget::GetOriginalDeviceScaleFactor() const {
2162 return 2163 return
2163 screen_metrics_emulator_ ? 2164 screen_metrics_emulator_ ?
2164 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : 2165 screen_metrics_emulator_->original_screen_info().deviceScaleFactor :
2165 device_scale_factor_; 2166 device_scale_factor_;
2166 } 2167 }
2167 2168
2168 } // namespace content 2169 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698