| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "third_party/WebKit/public/web/WebScreenInfo.h" | 51 #include "third_party/WebKit/public/web/WebScreenInfo.h" |
| 52 #include "third_party/skia/include/core/SkShader.h" | 52 #include "third_party/skia/include/core/SkShader.h" |
| 53 #include "ui/base/ui_base_switches.h" | 53 #include "ui/base/ui_base_switches.h" |
| 54 #include "ui/gfx/point.h" | 54 #include "ui/gfx/point.h" |
| 55 #include "ui/gfx/rect_conversions.h" | 55 #include "ui/gfx/rect_conversions.h" |
| 56 #include "ui/gfx/size_conversions.h" | 56 #include "ui/gfx/size_conversions.h" |
| 57 #include "ui/gfx/skia_util.h" | 57 #include "ui/gfx/skia_util.h" |
| 58 #include "ui/gl/gl_switches.h" | 58 #include "ui/gl/gl_switches.h" |
| 59 #include "ui/surface/transport_dib.h" | 59 #include "ui/surface/transport_dib.h" |
| 60 #include "webkit/glue/webkit_glue.h" | 60 #include "webkit/glue/webkit_glue.h" |
| 61 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 61 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" |
| 62 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" | 62 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
| 63 #include "webkit/renderer/cursor_utils.h" | 63 #include "webkit/renderer/cursor_utils.h" |
| 64 | 64 |
| 65 #if defined(OS_ANDROID) | 65 #if defined(OS_ANDROID) |
| 66 #include "content/renderer/android/synchronous_compositor_factory.h" | 66 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 #if defined(OS_POSIX) | 69 #if defined(OS_POSIX) |
| 70 #include "ipc/ipc_channel_posix.h" | 70 #include "ipc/ipc_channel_posix.h" |
| 71 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 71 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 canvas->scale(device_scale_factor_, device_scale_factor_); | 959 canvas->scale(device_scale_factor_, device_scale_factor_); |
| 960 canvas->clipRect(gfx::RectToSkRect(rect)); | 960 canvas->clipRect(gfx::RectToSkRect(rect)); |
| 961 canvas->drawPaint(paint); | 961 canvas->drawPaint(paint); |
| 962 canvas->restore(); | 962 canvas->restore(); |
| 963 } | 963 } |
| 964 | 964 |
| 965 // First see if this rect is a plugin that can paint itself faster. | 965 // First see if this rect is a plugin that can paint itself faster. |
| 966 TransportDIB* optimized_dib = NULL; | 966 TransportDIB* optimized_dib = NULL; |
| 967 gfx::Rect optimized_copy_rect, optimized_copy_location; | 967 gfx::Rect optimized_copy_rect, optimized_copy_location; |
| 968 float dib_scale_factor; | 968 float dib_scale_factor; |
| 969 webkit::ppapi::PluginInstance* optimized_instance = | 969 webkit::ppapi::PluginInstanceImpl* optimized_instance = |
| 970 GetBitmapForOptimizedPluginPaint(rect, &optimized_dib, | 970 GetBitmapForOptimizedPluginPaint(rect, &optimized_dib, |
| 971 &optimized_copy_location, | 971 &optimized_copy_location, |
| 972 &optimized_copy_rect, | 972 &optimized_copy_rect, |
| 973 &dib_scale_factor); | 973 &dib_scale_factor); |
| 974 if (optimized_instance) { | 974 if (optimized_instance) { |
| 975 // 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 |
| 976 // itself. We don't actually need the TransportDIB in this case. | 976 // itself. We don't actually need the TransportDIB in this case. |
| 977 // | 977 // |
| 978 // 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 |
| 979 // 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 |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 | 2014 |
| 2015 device_scale_factor_ = device_scale_factor; | 2015 device_scale_factor_ = device_scale_factor; |
| 2016 | 2016 |
| 2017 if (!is_accelerated_compositing_active_) { | 2017 if (!is_accelerated_compositing_active_) { |
| 2018 didInvalidateRect(gfx::Rect(size_.width(), size_.height())); | 2018 didInvalidateRect(gfx::Rect(size_.width(), size_.height())); |
| 2019 } else { | 2019 } else { |
| 2020 scheduleComposite(); | 2020 scheduleComposite(); |
| 2021 } | 2021 } |
| 2022 } | 2022 } |
| 2023 | 2023 |
| 2024 webkit::ppapi::PluginInstance* RenderWidget::GetBitmapForOptimizedPluginPaint( | 2024 webkit::ppapi::PluginInstanceImpl* |
| 2025 const gfx::Rect& paint_bounds, | 2025 RenderWidget::GetBitmapForOptimizedPluginPaint( |
| 2026 TransportDIB** dib, | 2026 const gfx::Rect& paint_bounds, |
| 2027 gfx::Rect* location, | 2027 TransportDIB** dib, |
| 2028 gfx::Rect* clip, | 2028 gfx::Rect* location, |
| 2029 float* scale_factor) { | 2029 gfx::Rect* clip, |
| 2030 float* scale_factor) { |
| 2030 // Bare RenderWidgets don't support optimized plugin painting. | 2031 // Bare RenderWidgets don't support optimized plugin painting. |
| 2031 return NULL; | 2032 return NULL; |
| 2032 } | 2033 } |
| 2033 | 2034 |
| 2034 gfx::Vector2d RenderWidget::GetScrollOffset() { | 2035 gfx::Vector2d RenderWidget::GetScrollOffset() { |
| 2035 // Bare RenderWidgets don't support scroll offset. | 2036 // Bare RenderWidgets don't support scroll offset. |
| 2036 return gfx::Vector2d(); | 2037 return gfx::Vector2d(); |
| 2037 } | 2038 } |
| 2038 | 2039 |
| 2039 void RenderWidget::SetHidden(bool hidden) { | 2040 void RenderWidget::SetHidden(bool hidden) { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 | 2484 |
| 2484 if (!context->InitializeWithDefaultBufferSizes( | 2485 if (!context->InitializeWithDefaultBufferSizes( |
| 2485 attributes, | 2486 attributes, |
| 2486 false /* bind generates resources */, | 2487 false /* bind generates resources */, |
| 2487 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2488 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2488 return NULL; | 2489 return NULL; |
| 2489 return context.release(); | 2490 return context.release(); |
| 2490 } | 2491 } |
| 2491 | 2492 |
| 2492 } // namespace content | 2493 } // namespace content |
| OLD | NEW |