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()); | |
jamesr
2012/11/06 18:36:14
why heap allocate? can't this go on the stack?
| |
127 display->SetScaleAndBounds( | |
128 std::min(screen_info.horizontalDPI, screen_info.verticalDPI) / | |
129 kStandardDPI, display->bounds()); | |
130 device_scale_factor_ = display->device_scale_factor(); | |
133 } | 131 } |
134 | 132 |
135 RenderWidget::~RenderWidget() { | 133 RenderWidget::~RenderWidget() { |
136 DCHECK(!webwidget_) << "Leaking our WebWidget!"; | 134 DCHECK(!webwidget_) << "Leaking our WebWidget!"; |
137 STLDeleteElements(&updates_pending_swap_); | 135 STLDeleteElements(&updates_pending_swap_); |
138 if (current_paint_buf_) { | 136 if (current_paint_buf_) { |
139 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); | 137 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); |
140 current_paint_buf_ = NULL; | 138 current_paint_buf_ = NULL; |
141 } | 139 } |
142 // If we are swapped out, we have released already. | 140 // If we are swapped out, we have released already. |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1921 | 1919 |
1922 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1920 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1923 return false; | 1921 return false; |
1924 } | 1922 } |
1925 | 1923 |
1926 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1924 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1927 return false; | 1925 return false; |
1928 } | 1926 } |
1929 | 1927 |
1930 } // namespace content | 1928 } // namespace content |
OLD | NEW |