Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
| 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
| 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 36 #include "third_party/skia/include/core/SkShader.h" | 36 #include "third_party/skia/include/core/SkShader.h" |
| 37 #include "ui/base/ui_base_switches.h" | 37 #include "ui/base/ui_base_switches.h" |
| 38 #include "ui/gfx/display.h" | |
| 38 #include "ui/gfx/rect_conversions.h" | 39 #include "ui/gfx/rect_conversions.h" |
| 39 #include "ui/gfx/size_conversions.h" | 40 #include "ui/gfx/size_conversions.h" |
| 40 #include "ui/gfx/skia_util.h" | 41 #include "ui/gfx/skia_util.h" |
| 41 #include "ui/gl/gl_switches.h" | 42 #include "ui/gl/gl_switches.h" |
| 42 #include "ui/surface/transport_dib.h" | 43 #include "ui/surface/transport_dib.h" |
| 43 #include "webkit/glue/webkit_glue.h" | 44 #include "webkit/glue/webkit_glue.h" |
| 44 #include "webkit/plugins/npapi/webplugin.h" | 45 #include "webkit/plugins/npapi/webplugin.h" |
| 45 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 46 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 46 | 47 |
| 47 #if defined(OS_POSIX) | 48 #if defined(OS_POSIX) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 screen_info_(screen_info), | 112 screen_info_(screen_info), |
| 112 device_scale_factor_(1), | 113 device_scale_factor_(1), |
| 113 throttle_input_events_(true), | 114 throttle_input_events_(true), |
| 114 next_smooth_scroll_gesture_id_(0), | 115 next_smooth_scroll_gesture_id_(0), |
| 115 is_threaded_compositing_enabled_(false) { | 116 is_threaded_compositing_enabled_(false) { |
| 116 if (!swapped_out) | 117 if (!swapped_out) |
| 117 RenderProcess::current()->AddRefProcess(); | 118 RenderProcess::current()->AddRefProcess(); |
| 118 DCHECK(RenderThread::Get()); | 119 DCHECK(RenderThread::Get()); |
| 119 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( | 120 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( |
| 120 switches::kDisableGpuVsync); | 121 switches::kDisableGpuVsync); |
| 121 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | |
| 122 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; | |
| 123 // Unless an explicit scale factor was provided for testing, ensure the scale | |
| 124 // is integral. | |
| 125 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
| 126 switches::kForceDeviceScaleFactor)) | |
| 127 device_scale_factor_ = static_cast<int>(device_scale_factor_); | |
| 128 device_scale_factor_ = std::max(1.0f, device_scale_factor_); | |
| 129 #endif | |
| 130 is_threaded_compositing_enabled_ = | 122 is_threaded_compositing_enabled_ = |
| 131 CommandLine::ForCurrentProcess()->HasSwitch( | 123 CommandLine::ForCurrentProcess()->HasSwitch( |
| 132 switches::kEnableThreadedCompositing); | 124 switches::kEnableThreadedCompositing); |
| 125 | |
| 126 scoped_ptr<gfx::Display> display(new gfx::Display()); | |
| 127 display->SetScaleAndBounds( | |
|
johnme
2012/11/06 15:45:34
Would it make sense to make a new constructor for
Sami
2012/11/06 17:08:47
Good idea, that makes things a little cleaner. Som
| |
| 128 screen_info.verticalDPI / kStandardDPI, display->bounds()); | |
|
johnme
2012/11/06 15:45:34
Presumably this works on Android because in practi
Sami
2012/11/06 17:08:47
That's right, and based on the discussion it seems
| |
| 129 device_scale_factor_ = display->device_scale_factor(); | |
| 133 } | 130 } |
| 134 | 131 |
| 135 RenderWidget::~RenderWidget() { | 132 RenderWidget::~RenderWidget() { |
| 136 DCHECK(!webwidget_) << "Leaking our WebWidget!"; | 133 DCHECK(!webwidget_) << "Leaking our WebWidget!"; |
| 137 STLDeleteElements(&updates_pending_swap_); | 134 STLDeleteElements(&updates_pending_swap_); |
| 138 if (current_paint_buf_) { | 135 if (current_paint_buf_) { |
| 139 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); | 136 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); |
| 140 current_paint_buf_ = NULL; | 137 current_paint_buf_ = NULL; |
| 141 } | 138 } |
| 142 // If we are swapped out, we have released already. | 139 // If we are swapped out, we have released already. |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1921 | 1918 |
| 1922 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1919 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 1923 return false; | 1920 return false; |
| 1924 } | 1921 } |
| 1925 | 1922 |
| 1926 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1923 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
| 1927 return false; | 1924 return false; |
| 1928 } | 1925 } |
| 1929 | 1926 |
| 1930 } // namespace content | 1927 } // namespace content |
| OLD | NEW |