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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 process_->WidgetRestored(); | 219 process_->WidgetRestored(); |
220 | 220 |
221 input_router_.reset(new InputRouterImpl( | 221 input_router_.reset(new InputRouterImpl( |
222 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); | 222 process_, this, this, routing_id_, GetInputRouterConfigForPlatform())); |
223 | 223 |
224 touch_emulator_.reset(); | 224 touch_emulator_.reset(); |
225 | 225 |
226 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 226 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
227 IsRenderView() ? RenderViewHost::From(this) : NULL); | 227 IsRenderView() ? RenderViewHost::From(this) : NULL); |
228 if (BrowserPluginGuest::IsGuest(rvh) || | 228 if (BrowserPluginGuest::IsGuest(rvh) || |
229 !CommandLine::ForCurrentProcess()->HasSwitch( | 229 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
230 switches::kDisableHangMonitor)) { | 230 switches::kDisableHangMonitor)) { |
231 hang_monitor_timeout_.reset(new TimeoutMonitor( | 231 hang_monitor_timeout_.reset(new TimeoutMonitor( |
232 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, | 232 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, |
233 weak_factory_.GetWeakPtr()))); | 233 weak_factory_.GetWeakPtr()))); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 RenderWidgetHostImpl::~RenderWidgetHostImpl() { | 237 RenderWidgetHostImpl::~RenderWidgetHostImpl() { |
238 SetView(NULL); | 238 SetView(NULL); |
239 | 239 |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 | 1555 |
1556 // Log the time delta for processing a paint message. | 1556 // Log the time delta for processing a paint message. |
1557 TimeTicks now = TimeTicks::Now(); | 1557 TimeTicks now = TimeTicks::Now(); |
1558 TimeDelta delta = now - update_start; | 1558 TimeDelta delta = now - update_start; |
1559 UMA_HISTOGRAM_TIMES("MPArch.RWH_DidUpdateBackingStore", delta); | 1559 UMA_HISTOGRAM_TIMES("MPArch.RWH_DidUpdateBackingStore", delta); |
1560 } | 1560 } |
1561 | 1561 |
1562 void RenderWidgetHostImpl::OnQueueSyntheticGesture( | 1562 void RenderWidgetHostImpl::OnQueueSyntheticGesture( |
1563 const SyntheticGesturePacket& gesture_packet) { | 1563 const SyntheticGesturePacket& gesture_packet) { |
1564 // Only allow untrustworthy gestures if explicitly enabled. | 1564 // Only allow untrustworthy gestures if explicitly enabled. |
1565 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1565 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1566 cc::switches::kEnableGpuBenchmarking)) { | 1566 cc::switches::kEnableGpuBenchmarking)) { |
1567 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH7")); | 1567 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH7")); |
1568 GetProcess()->ReceivedBadMessage(); | 1568 GetProcess()->ReceivedBadMessage(); |
1569 return; | 1569 return; |
1570 } | 1570 } |
1571 | 1571 |
1572 QueueSyntheticGesture( | 1572 QueueSyntheticGesture( |
1573 SyntheticGesture::Create(*gesture_packet.gesture_params()), | 1573 SyntheticGesture::Create(*gesture_packet.gesture_params()), |
1574 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, | 1574 base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted, |
1575 weak_factory_.GetWeakPtr())); | 1575 weak_factory_.GetWeakPtr())); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 routing_id, snapshot_id, snapshot_size, png_data->data())); | 2159 routing_id, snapshot_id, snapshot_size, png_data->data())); |
2160 } | 2160 } |
2161 | 2161 |
2162 void RenderWidgetHostImpl::WindowOldSnapshotReachedScreen(int snapshot_id) { | 2162 void RenderWidgetHostImpl::WindowOldSnapshotReachedScreen(int snapshot_id) { |
2163 DCHECK(base::MessageLoopForUI::IsCurrent()); | 2163 DCHECK(base::MessageLoopForUI::IsCurrent()); |
2164 | 2164 |
2165 std::vector<unsigned char> png; | 2165 std::vector<unsigned char> png; |
2166 | 2166 |
2167 // This feature is behind the kEnableGpuBenchmarking command line switch | 2167 // This feature is behind the kEnableGpuBenchmarking command line switch |
2168 // because it poses security concerns and should only be used for testing. | 2168 // because it poses security concerns and should only be used for testing. |
2169 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2169 const base::CommandLine& command_line = |
| 2170 *base::CommandLine::ForCurrentProcess(); |
2170 if (!command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) { | 2171 if (!command_line.HasSwitch(cc::switches::kEnableGpuBenchmarking)) { |
2171 Send(new ViewMsg_WindowSnapshotCompleted( | 2172 Send(new ViewMsg_WindowSnapshotCompleted( |
2172 GetRoutingID(), snapshot_id, gfx::Size(), png)); | 2173 GetRoutingID(), snapshot_id, gfx::Size(), png)); |
2173 return; | 2174 return; |
2174 } | 2175 } |
2175 | 2176 |
2176 gfx::Rect view_bounds = GetView()->GetViewBounds(); | 2177 gfx::Rect view_bounds = GetView()->GetViewBounds(); |
2177 gfx::Rect snapshot_bounds(view_bounds.size()); | 2178 gfx::Rect snapshot_bounds(view_bounds.size()); |
2178 gfx::Size snapshot_size = snapshot_bounds.size(); | 2179 gfx::Size snapshot_size = snapshot_bounds.size(); |
2179 | 2180 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 } | 2317 } |
2317 #endif | 2318 #endif |
2318 | 2319 |
2319 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2320 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2320 if (view_) | 2321 if (view_) |
2321 return view_->PreferredReadbackFormat(); | 2322 return view_->PreferredReadbackFormat(); |
2322 return kN32_SkColorType; | 2323 return kN32_SkColorType; |
2323 } | 2324 } |
2324 | 2325 |
2325 } // namespace content | 2326 } // namespace content |
OLD | NEW |