| OLD | NEW |
| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/common/swapped_out_messages.h" | 24 #include "content/common/swapped_out_messages.h" |
| 25 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
| 26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 27 #include "content/renderer/gpu/compositor_output_surface.h" | 27 #include "content/renderer/gpu/compositor_output_surface.h" |
| 28 #include "content/renderer/gpu/compositor_software_output_device.h" | 28 #include "content/renderer/gpu/compositor_software_output_device.h" |
| 29 #include "content/renderer/gpu/delegated_compositor_output_surface.h" | 29 #include "content/renderer/gpu/delegated_compositor_output_surface.h" |
| 30 #include "content/renderer/gpu/input_handler_manager.h" | 30 #include "content/renderer/gpu/input_handler_manager.h" |
| 31 #include "content/renderer/gpu/mailbox_output_surface.h" | 31 #include "content/renderer/gpu/mailbox_output_surface.h" |
| 32 #include "content/renderer/gpu/render_widget_compositor.h" | 32 #include "content/renderer/gpu/render_widget_compositor.h" |
| 33 #include "content/renderer/ime_event_guard.h" | 33 #include "content/renderer/ime_event_guard.h" |
| 34 #include "content/renderer/pepper/ppapi_plugin_instance_impl.h" |
| 34 #include "content/renderer/render_process.h" | 35 #include "content/renderer/render_process.h" |
| 35 #include "content/renderer/render_process_visibility_manager.h" | 36 #include "content/renderer/render_process_visibility_manager.h" |
| 36 #include "content/renderer/render_thread_impl.h" | 37 #include "content/renderer/render_thread_impl.h" |
| 37 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 38 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 38 #include "ipc/ipc_sync_message.h" | 39 #include "ipc/ipc_sync_message.h" |
| 39 #include "skia/ext/platform_canvas.h" | 40 #include "skia/ext/platform_canvas.h" |
| 40 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 41 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 41 #include "third_party/WebKit/public/platform/WebPoint.h" | 42 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 42 #include "third_party/WebKit/public/platform/WebRect.h" | 43 #include "third_party/WebKit/public/platform/WebRect.h" |
| 43 #include "third_party/WebKit/public/platform/WebSize.h" | 44 #include "third_party/WebKit/public/platform/WebSize.h" |
| 44 #include "third_party/WebKit/public/platform/WebString.h" | 45 #include "third_party/WebKit/public/platform/WebString.h" |
| 45 #include "third_party/WebKit/public/web/WebCursorInfo.h" | 46 #include "third_party/WebKit/public/web/WebCursorInfo.h" |
| 46 #include "third_party/WebKit/public/web/WebHelperPlugin.h" | 47 #include "third_party/WebKit/public/web/WebHelperPlugin.h" |
| 47 #include "third_party/WebKit/public/web/WebPagePopup.h" | 48 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 48 #include "third_party/WebKit/public/web/WebPopupMenu.h" | 49 #include "third_party/WebKit/public/web/WebPopupMenu.h" |
| 49 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" | 50 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" |
| 50 #include "third_party/WebKit/public/web/WebRange.h" | 51 #include "third_party/WebKit/public/web/WebRange.h" |
| 51 #include "third_party/WebKit/public/web/WebScreenInfo.h" | 52 #include "third_party/WebKit/public/web/WebScreenInfo.h" |
| 52 #include "third_party/skia/include/core/SkShader.h" | 53 #include "third_party/skia/include/core/SkShader.h" |
| 53 #include "ui/base/ui_base_switches.h" | 54 #include "ui/base/ui_base_switches.h" |
| 54 #include "ui/gfx/point.h" | 55 #include "ui/gfx/point.h" |
| 55 #include "ui/gfx/rect_conversions.h" | 56 #include "ui/gfx/rect_conversions.h" |
| 56 #include "ui/gfx/size_conversions.h" | 57 #include "ui/gfx/size_conversions.h" |
| 57 #include "ui/gfx/skia_util.h" | 58 #include "ui/gfx/skia_util.h" |
| 58 #include "ui/gl/gl_switches.h" | 59 #include "ui/gl/gl_switches.h" |
| 59 #include "ui/surface/transport_dib.h" | 60 #include "ui/surface/transport_dib.h" |
| 60 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" | |
| 61 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" | 61 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
| 62 #include "webkit/renderer/cursor_utils.h" | 62 #include "webkit/renderer/cursor_utils.h" |
| 63 | 63 |
| 64 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
| 65 #include "content/renderer/android/synchronous_compositor_factory.h" | 65 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 #if defined(OS_POSIX) | 68 #if defined(OS_POSIX) |
| 69 #include "ipc/ipc_channel_posix.h" | 69 #include "ipc/ipc_channel_posix.h" |
| 70 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 70 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 // First see if this rect is a plugin that can paint itself faster. | 964 // First see if this rect is a plugin that can paint itself faster. |
| 965 TransportDIB* optimized_dib = NULL; | 965 TransportDIB* optimized_dib = NULL; |
| 966 gfx::Rect optimized_copy_rect, optimized_copy_location; | 966 gfx::Rect optimized_copy_rect, optimized_copy_location; |
| 967 float dib_scale_factor; | 967 float dib_scale_factor; |
| 968 webkit::ppapi::PluginInstanceImpl* optimized_instance = | 968 webkit::ppapi::PluginInstanceImpl* optimized_instance = |
| 969 GetBitmapForOptimizedPluginPaint(rect, &optimized_dib, | 969 GetBitmapForOptimizedPluginPaint(rect, &optimized_dib, |
| 970 &optimized_copy_location, | 970 &optimized_copy_location, |
| 971 &optimized_copy_rect, | 971 &optimized_copy_rect, |
| 972 &dib_scale_factor); | 972 &dib_scale_factor); |
| 973 if (optimized_instance) { | 973 if (optimized_instance) { |
| 974 #if defined(ENABLE_PLUGINS) |
| 974 // This plugin can be optimize-painted and we can just ask it to paint | 975 // This plugin can be optimize-painted and we can just ask it to paint |
| 975 // itself. We don't actually need the TransportDIB in this case. | 976 // itself. We don't actually need the TransportDIB in this case. |
| 976 // | 977 // |
| 977 // This is an optimization for PPAPI plugins that know they're on top of | 978 // This is an optimization for PPAPI plugins that know they're on top of |
| 978 // the page content. If this rect is inside such a plugin, we can save some | 979 // the page content. If this rect is inside such a plugin, we can save some |
| 979 // time and avoid re-rendering the page content which we know will be | 980 // time and avoid re-rendering the page content which we know will be |
| 980 // covered by the plugin later (this time can be significant, especially | 981 // covered by the plugin later (this time can be significant, especially |
| 981 // for a playing movie that is invalidating a lot). | 982 // for a playing movie that is invalidating a lot). |
| 982 // | 983 // |
| 983 // In the plugin movie case, hopefully the similar call to | 984 // In the plugin movie case, hopefully the similar call to |
| (...skipping 14 matching lines...) Expand all Loading... |
| 998 SkAutoCanvasRestore auto_restore(canvas, true); | 999 SkAutoCanvasRestore auto_restore(canvas, true); |
| 999 canvas->scale(device_scale_factor_, device_scale_factor_); | 1000 canvas->scale(device_scale_factor_, device_scale_factor_); |
| 1000 optimized_instance->Paint(canvas, optimized_copy_location, rect); | 1001 optimized_instance->Paint(canvas, optimized_copy_location, rect); |
| 1001 canvas->restore(); | 1002 canvas->restore(); |
| 1002 if (kEnableGpuBenchmarking) { | 1003 if (kEnableGpuBenchmarking) { |
| 1003 base::TimeDelta paint_time = | 1004 base::TimeDelta paint_time = |
| 1004 base::TimeTicks::HighResNow() - paint_begin_ticks; | 1005 base::TimeTicks::HighResNow() - paint_begin_ticks; |
| 1005 if (!is_accelerated_compositing_active_) | 1006 if (!is_accelerated_compositing_active_) |
| 1006 software_stats_.total_paint_time += paint_time; | 1007 software_stats_.total_paint_time += paint_time; |
| 1007 } | 1008 } |
| 1009 #endif |
| 1008 } else { | 1010 } else { |
| 1009 // Normal painting case. | 1011 // Normal painting case. |
| 1010 base::TimeTicks paint_begin_ticks; | 1012 base::TimeTicks paint_begin_ticks; |
| 1011 if (kEnableGpuBenchmarking) | 1013 if (kEnableGpuBenchmarking) |
| 1012 paint_begin_ticks = base::TimeTicks::HighResNow(); | 1014 paint_begin_ticks = base::TimeTicks::HighResNow(); |
| 1013 | 1015 |
| 1014 webwidget_->paint(canvas, rect); | 1016 webwidget_->paint(canvas, rect); |
| 1015 | 1017 |
| 1016 if (kEnableGpuBenchmarking) { | 1018 if (kEnableGpuBenchmarking) { |
| 1017 base::TimeDelta paint_time = | 1019 base::TimeDelta paint_time = |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2482 | 2484 |
| 2483 if (!context->InitializeWithDefaultBufferSizes( | 2485 if (!context->InitializeWithDefaultBufferSizes( |
| 2484 attributes, | 2486 attributes, |
| 2485 false /* bind generates resources */, | 2487 false /* bind generates resources */, |
| 2486 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2488 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2487 return NULL; | 2489 return NULL; |
| 2488 return context.release(); | 2490 return context.release(); |
| 2489 } | 2491 } |
| 2490 | 2492 |
| 2491 } // namespace content | 2493 } // namespace content |
| OLD | NEW |