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

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

Issue 1408123005: Android Webview IPC-based sync compositing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "ui/gfx/geometry/point_conversions.h" 76 #include "ui/gfx/geometry/point_conversions.h"
77 #include "ui/gfx/geometry/rect_conversions.h" 77 #include "ui/gfx/geometry/rect_conversions.h"
78 #include "ui/gfx/geometry/size_conversions.h" 78 #include "ui/gfx/geometry/size_conversions.h"
79 #include "ui/gfx/skia_util.h" 79 #include "ui/gfx/skia_util.h"
80 #include "ui/gl/gl_switches.h" 80 #include "ui/gl/gl_switches.h"
81 #include "ui/surface/transport_dib.h" 81 #include "ui/surface/transport_dib.h"
82 82
83 #if defined(OS_ANDROID) 83 #if defined(OS_ANDROID)
84 #include <android/keycodes.h> 84 #include <android/keycodes.h>
85 #include "content/renderer/android/synchronous_compositor_factory.h" 85 #include "content/renderer/android/synchronous_compositor_factory.h"
86 #include "content/renderer/android/synchronous_compositor_filter.h"
87 #include "content/renderer/android/synchronous_compositor_output_surface.h"
86 #endif 88 #endif
87 89
88 #if defined(OS_POSIX) 90 #if defined(OS_POSIX)
89 #include "ipc/ipc_channel_posix.h" 91 #include "ipc/ipc_channel_posix.h"
90 #include "third_party/skia/include/core/SkMallocPixelRef.h" 92 #include "third_party/skia/include/core/SkMallocPixelRef.h"
91 #include "third_party/skia/include/core/SkPixelRef.h" 93 #include "third_party/skia/include/core/SkPixelRef.h"
92 #endif // defined(OS_POSIX) 94 #endif // defined(OS_POSIX)
93 95
94 #include "third_party/WebKit/public/web/WebWidget.h" 96 #include "third_party/WebKit/public/web/WebWidget.h"
95 97
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 // Cause the compositor to wait and try again. 1015 // Cause the compositor to wait and try again.
1014 return nullptr; 1016 return nullptr;
1015 } 1017 }
1016 1018
1017 #if defined(OS_ANDROID) 1019 #if defined(OS_ANDROID)
1018 if (SynchronousCompositorFactory* factory = 1020 if (SynchronousCompositorFactory* factory =
1019 SynchronousCompositorFactory::GetInstance()) { 1021 SynchronousCompositorFactory::GetInstance()) {
1020 return factory->CreateOutputSurface( 1022 return factory->CreateOutputSurface(
1021 routing_id(), frame_swap_message_queue_, context_provider, 1023 routing_id(), frame_swap_message_queue_, context_provider,
1022 worker_context_provider); 1024 worker_context_provider);
1025 } else if (RenderThreadImpl::current()->sync_compositor_message_filter()) {
1026 return make_scoped_ptr(new SynchronousCompositorOutputSurface(
1027 context_provider, worker_context_provider, routing_id(),
1028 content::RenderThreadImpl::current()
1029 ->sync_compositor_message_filter(),
1030 frame_swap_message_queue_));
1023 } 1031 }
1024 #endif 1032 #endif
1025 } 1033 }
1026 1034
1027 uint32 output_surface_id = next_output_surface_id_++; 1035 uint32 output_surface_id = next_output_surface_id_++;
1028 // Composite-to-mailbox is currently used for layout tests in order to cause 1036 // Composite-to-mailbox is currently used for layout tests in order to cause
1029 // them to draw inside in the renderer to do the readback there. This should 1037 // them to draw inside in the renderer to do the readback there. This should
1030 // no longer be the case when crbug.com/311404 is fixed. 1038 // no longer be the case when crbug.com/311404 is fixed.
1031 if (!RenderThreadImpl::current() || 1039 if (!RenderThreadImpl::current() ||
1032 !RenderThreadImpl::current()->layout_test_mode()) { 1040 !RenderThreadImpl::current()->layout_test_mode()) {
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 blink::WebGraphicsContext3D::Attributes attributes; 2354 blink::WebGraphicsContext3D::Attributes attributes;
2347 attributes.antialias = false; 2355 attributes.antialias = false;
2348 attributes.shareResources = true; 2356 attributes.shareResources = true;
2349 attributes.noAutomaticFlushes = true; 2357 attributes.noAutomaticFlushes = true;
2350 attributes.depth = false; 2358 attributes.depth = false;
2351 attributes.stencil = false; 2359 attributes.stencil = false;
2352 bool lose_context_when_out_of_memory = true; 2360 bool lose_context_when_out_of_memory = true;
2353 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 2361 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
2354 #if defined(OS_ANDROID) 2362 #if defined(OS_ANDROID)
2355 bool using_synchronous_compositing = 2363 bool using_synchronous_compositing =
2356 SynchronousCompositorFactory::GetInstance(); 2364 SynchronousCompositorFactory::GetInstance() ||
2365 base::CommandLine::ForCurrentProcess()->HasSwitch(
2366 switches::kIPCSyncCompositing);
2357 // If we raster too fast we become upload bound, and pending 2367 // If we raster too fast we become upload bound, and pending
2358 // uploads consume memory. For maximum upload throughput, we would 2368 // uploads consume memory. For maximum upload throughput, we would
2359 // want to allow for upload_throughput * pipeline_time of pending 2369 // want to allow for upload_throughput * pipeline_time of pending
2360 // uploads, after which we are just wasting memory. Since we don't 2370 // uploads, after which we are just wasting memory. Since we don't
2361 // know our upload throughput yet, this just caps our memory usage. 2371 // know our upload throughput yet, this just caps our memory usage.
2362 // Synchronous compositor uses half because synchronous compositor 2372 // Synchronous compositor uses half because synchronous compositor
2363 // pipeline is only one frame deep. But twice of half for low end 2373 // pipeline is only one frame deep. But twice of half for low end
2364 // because 16bit texture is not supported. 2374 // because 16bit texture is not supported.
2365 size_t divider = using_synchronous_compositing ? 2 : 1; 2375 size_t divider = using_synchronous_compositing ? 2 : 1;
2366 if (base::SysInfo::IsLowEndDevice()) 2376 if (base::SysInfo::IsLowEndDevice())
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2421 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2412 video_hole_frames_.AddObserver(frame); 2422 video_hole_frames_.AddObserver(frame);
2413 } 2423 }
2414 2424
2415 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2425 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2416 video_hole_frames_.RemoveObserver(frame); 2426 video_hole_frames_.RemoveObserver(frame);
2417 } 2427 }
2418 #endif // defined(VIDEO_HOLE) 2428 #endif // defined(VIDEO_HOLE)
2419 2429
2420 } // namespace content 2430 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698