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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 338 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
339 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted) | 339 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted) |
340 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 340 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
341 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 341 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
342 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 342 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
343 #if defined(OS_ANDROID) | 343 #if defined(OS_ANDROID) |
344 IPC_MESSAGE_HANDLER(ViewMsg_ImeBatchStateChanged, OnImeBatchStateChanged) | 344 IPC_MESSAGE_HANDLER(ViewMsg_ImeBatchStateChanged, OnImeBatchStateChanged) |
345 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) | 345 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
346 #endif | 346 #endif |
347 IPC_MESSAGE_HANDLER(ViewMsg_Snapshot, OnSnapshot) | 347 IPC_MESSAGE_HANDLER(ViewMsg_Snapshot, OnSnapshot) |
| 348 IPC_MESSAGE_HANDLER(ViewMsg_SetBrowserRenderingStats, |
| 349 OnSetBrowserRenderingStats) |
348 IPC_MESSAGE_UNHANDLED(handled = false) | 350 IPC_MESSAGE_UNHANDLED(handled = false) |
349 IPC_END_MESSAGE_MAP() | 351 IPC_END_MESSAGE_MAP() |
350 return handled; | 352 return handled; |
351 } | 353 } |
352 | 354 |
353 bool RenderWidget::Send(IPC::Message* message) { | 355 bool RenderWidget::Send(IPC::Message* message) { |
354 // Don't send any messages after the browser has told us to close, and filter | 356 // Don't send any messages after the browser has told us to close, and filter |
355 // most outgoing messages while swapped out. | 357 // most outgoing messages while swapped out. |
356 if ((is_swapped_out_ && | 358 if ((is_swapped_out_ && |
357 !SwappedOutMessages::CanSendWhileSwappedOut(message)) || | 359 !SwappedOutMessages::CanSendWhileSwappedOut(message)) || |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2317 if (!gpu_channel) | 2319 if (!gpu_channel) |
2318 return false; | 2320 return false; |
2319 | 2321 |
2320 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats); | 2322 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats); |
2321 } | 2323 } |
2322 | 2324 |
2323 RenderWidgetCompositor* RenderWidget::compositor() const { | 2325 RenderWidgetCompositor* RenderWidget::compositor() const { |
2324 return compositor_.get(); | 2326 return compositor_.get(); |
2325 } | 2327 } |
2326 | 2328 |
| 2329 void RenderWidget::OnSetBrowserRenderingStats( |
| 2330 const BrowserRenderingStats& stats) { |
| 2331 browser_rendering_stats_ = stats; |
| 2332 } |
| 2333 |
| 2334 void RenderWidget::GetBrowserRenderingStats(BrowserRenderingStats* stats) { |
| 2335 *stats = browser_rendering_stats_; |
| 2336 } |
| 2337 |
2327 void RenderWidget::BeginSmoothScroll( | 2338 void RenderWidget::BeginSmoothScroll( |
2328 bool down, | 2339 bool down, |
2329 const SmoothScrollCompletionCallback& callback, | 2340 const SmoothScrollCompletionCallback& callback, |
2330 int pixels_to_scroll, | 2341 int pixels_to_scroll, |
2331 int mouse_event_x, | 2342 int mouse_event_x, |
2332 int mouse_event_y) { | 2343 int mouse_event_y) { |
2333 DCHECK(!callback.is_null()); | 2344 DCHECK(!callback.is_null()); |
2334 | 2345 |
2335 ViewHostMsg_BeginSmoothScroll_Params params; | 2346 ViewHostMsg_BeginSmoothScroll_Params params; |
2336 params.scroll_down = down; | 2347 params.scroll_down = down; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2381 | 2392 |
2382 if (!context->Initialize( | 2393 if (!context->Initialize( |
2383 attributes, | 2394 attributes, |
2384 false /* bind generates resources */, | 2395 false /* bind generates resources */, |
2385 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2396 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2386 return NULL; | 2397 return NULL; |
2387 return context.release(); | 2398 return context.release(); |
2388 } | 2399 } |
2389 | 2400 |
2390 } // namespace content | 2401 } // namespace content |
OLD | NEW |