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

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: fix win compile 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
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "ui/gfx/geometry/point_conversions.h" 77 #include "ui/gfx/geometry/point_conversions.h"
78 #include "ui/gfx/geometry/rect_conversions.h" 78 #include "ui/gfx/geometry/rect_conversions.h"
79 #include "ui/gfx/geometry/size_conversions.h" 79 #include "ui/gfx/geometry/size_conversions.h"
80 #include "ui/gfx/skia_util.h" 80 #include "ui/gfx/skia_util.h"
81 #include "ui/gl/gl_switches.h" 81 #include "ui/gl/gl_switches.h"
82 #include "ui/surface/transport_dib.h" 82 #include "ui/surface/transport_dib.h"
83 83
84 #if defined(OS_ANDROID) 84 #if defined(OS_ANDROID)
85 #include <android/keycodes.h> 85 #include <android/keycodes.h>
86 #include "content/renderer/android/synchronous_compositor_factory.h" 86 #include "content/renderer/android/synchronous_compositor_factory.h"
87 #include "content/renderer/android/synchronous_compositor_filter.h"
88 #include "content/renderer/android/synchronous_compositor_output_surface.h"
87 #endif 89 #endif
88 90
89 #if defined(OS_POSIX) 91 #if defined(OS_POSIX)
90 #include "ipc/ipc_channel_posix.h" 92 #include "ipc/ipc_channel_posix.h"
91 #include "third_party/skia/include/core/SkMallocPixelRef.h" 93 #include "third_party/skia/include/core/SkMallocPixelRef.h"
92 #include "third_party/skia/include/core/SkPixelRef.h" 94 #include "third_party/skia/include/core/SkPixelRef.h"
93 #endif // defined(OS_POSIX) 95 #endif // defined(OS_POSIX)
94 96
95 #include "third_party/WebKit/public/web/WebWidget.h" 97 #include "third_party/WebKit/public/web/WebWidget.h"
96 98
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 // Cause the compositor to wait and try again. 1027 // Cause the compositor to wait and try again.
1026 return nullptr; 1028 return nullptr;
1027 } 1029 }
1028 1030
1029 #if defined(OS_ANDROID) 1031 #if defined(OS_ANDROID)
1030 if (SynchronousCompositorFactory* factory = 1032 if (SynchronousCompositorFactory* factory =
1031 SynchronousCompositorFactory::GetInstance()) { 1033 SynchronousCompositorFactory::GetInstance()) {
1032 return factory->CreateOutputSurface( 1034 return factory->CreateOutputSurface(
1033 routing_id(), frame_swap_message_queue_, context_provider, 1035 routing_id(), frame_swap_message_queue_, context_provider,
1034 worker_context_provider); 1036 worker_context_provider);
1037 } else if (RenderThreadImpl::current()->sync_compositor_message_filter()) {
1038 return make_scoped_ptr(new SynchronousCompositorOutputSurface(
1039 context_provider, worker_context_provider, routing_id(),
1040 content::RenderThreadImpl::current()
1041 ->sync_compositor_message_filter(),
1042 frame_swap_message_queue_));
1035 } 1043 }
1036 #endif 1044 #endif
1037 } 1045 }
1038 1046
1039 uint32 output_surface_id = next_output_surface_id_++; 1047 uint32 output_surface_id = next_output_surface_id_++;
1040 // Composite-to-mailbox is currently used for layout tests in order to cause 1048 // Composite-to-mailbox is currently used for layout tests in order to cause
1041 // them to draw inside in the renderer to do the readback there. This should 1049 // them to draw inside in the renderer to do the readback there. This should
1042 // no longer be the case when crbug.com/311404 is fixed. 1050 // no longer be the case when crbug.com/311404 is fixed.
1043 if (!RenderThreadImpl::current() || 1051 if (!RenderThreadImpl::current() ||
1044 !RenderThreadImpl::current()->layout_test_mode()) { 1052 !RenderThreadImpl::current()->layout_test_mode()) {
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 blink::WebGraphicsContext3D::Attributes attributes; 2374 blink::WebGraphicsContext3D::Attributes attributes;
2367 attributes.antialias = false; 2375 attributes.antialias = false;
2368 attributes.shareResources = true; 2376 attributes.shareResources = true;
2369 attributes.noAutomaticFlushes = true; 2377 attributes.noAutomaticFlushes = true;
2370 attributes.depth = false; 2378 attributes.depth = false;
2371 attributes.stencil = false; 2379 attributes.stencil = false;
2372 bool lose_context_when_out_of_memory = true; 2380 bool lose_context_when_out_of_memory = true;
2373 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 2381 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
2374 #if defined(OS_ANDROID) 2382 #if defined(OS_ANDROID)
2375 bool using_synchronous_compositing = 2383 bool using_synchronous_compositing =
2376 SynchronousCompositorFactory::GetInstance(); 2384 SynchronousCompositorFactory::GetInstance() ||
2385 base::CommandLine::ForCurrentProcess()->HasSwitch(
2386 switches::kIPCSyncCompositing);
2377 // If we raster too fast we become upload bound, and pending 2387 // If we raster too fast we become upload bound, and pending
2378 // uploads consume memory. For maximum upload throughput, we would 2388 // uploads consume memory. For maximum upload throughput, we would
2379 // want to allow for upload_throughput * pipeline_time of pending 2389 // want to allow for upload_throughput * pipeline_time of pending
2380 // uploads, after which we are just wasting memory. Since we don't 2390 // uploads, after which we are just wasting memory. Since we don't
2381 // know our upload throughput yet, this just caps our memory usage. 2391 // know our upload throughput yet, this just caps our memory usage.
2382 // Synchronous compositor uses half because synchronous compositor 2392 // Synchronous compositor uses half because synchronous compositor
2383 // pipeline is only one frame deep. But twice of half for low end 2393 // pipeline is only one frame deep. But twice of half for low end
2384 // because 16bit texture is not supported. 2394 // because 16bit texture is not supported.
2385 size_t divider = using_synchronous_compositing ? 2 : 1; 2395 size_t divider = using_synchronous_compositing ? 2 : 1;
2386 if (base::SysInfo::IsLowEndDevice()) 2396 if (base::SysInfo::IsLowEndDevice())
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2441 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2432 video_hole_frames_.AddObserver(frame); 2442 video_hole_frames_.AddObserver(frame);
2433 } 2443 }
2434 2444
2435 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2445 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2436 video_hole_frames_.RemoveObserver(frame); 2446 video_hole_frames_.RemoveObserver(frame);
2437 } 2447 }
2438 #endif // defined(VIDEO_HOLE) 2448 #endif // defined(VIDEO_HOLE)
2439 2449
2440 } // namespace content 2450 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698