| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/stack_trace.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 13 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
| 18 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
| 19 #include "base/trace_event/trace_event_synthetic_delay.h" | 20 #include "base/trace_event/trace_event_synthetic_delay.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 #include "content/renderer/gpu/queue_message_swap_promise.h" | 46 #include "content/renderer/gpu/queue_message_swap_promise.h" |
| 46 #include "content/renderer/gpu/render_widget_compositor.h" | 47 #include "content/renderer/gpu/render_widget_compositor.h" |
| 47 #include "content/renderer/ime_event_guard.h" | 48 #include "content/renderer/ime_event_guard.h" |
| 48 #include "content/renderer/input/input_handler_manager.h" | 49 #include "content/renderer/input/input_handler_manager.h" |
| 49 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 50 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 50 #include "content/renderer/render_frame_impl.h" | 51 #include "content/renderer/render_frame_impl.h" |
| 51 #include "content/renderer/render_frame_proxy.h" | 52 #include "content/renderer/render_frame_proxy.h" |
| 52 #include "content/renderer/render_process.h" | 53 #include "content/renderer/render_process.h" |
| 53 #include "content/renderer/render_thread_impl.h" | 54 #include "content/renderer/render_thread_impl.h" |
| 54 #include "content/renderer/render_view_impl.h" | 55 #include "content/renderer/render_view_impl.h" |
| 56 #include "content/renderer/render_widget_mus_connection.h" |
| 55 #include "content/renderer/renderer_blink_platform_impl.h" | 57 #include "content/renderer/renderer_blink_platform_impl.h" |
| 56 #include "content/renderer/resizing_mode_selector.h" | 58 #include "content/renderer/resizing_mode_selector.h" |
| 57 #include "ipc/ipc_sync_message.h" | 59 #include "ipc/ipc_sync_message.h" |
| 58 #include "skia/ext/platform_canvas.h" | 60 #include "skia/ext/platform_canvas.h" |
| 59 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 61 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
| 60 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 62 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 61 #include "third_party/WebKit/public/platform/WebPoint.h" | 63 #include "third_party/WebKit/public/platform/WebPoint.h" |
| 62 #include "third_party/WebKit/public/platform/WebRect.h" | 64 #include "third_party/WebKit/public/platform/WebRect.h" |
| 63 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 65 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 64 #include "third_party/WebKit/public/platform/WebSize.h" | 66 #include "third_party/WebKit/public/platform/WebSize.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 device_scale_factor_(screen_info_.deviceScaleFactor), | 522 device_scale_factor_(screen_info_.deviceScaleFactor), |
| 521 next_output_surface_id_(0), | 523 next_output_surface_id_(0), |
| 522 #if defined(OS_ANDROID) | 524 #if defined(OS_ANDROID) |
| 523 text_field_is_dirty_(false), | 525 text_field_is_dirty_(false), |
| 524 #endif | 526 #endif |
| 525 popup_origin_scale_for_emulation_(0.f), | 527 popup_origin_scale_for_emulation_(0.f), |
| 526 frame_swap_message_queue_(new FrameSwapMessageQueue()), | 528 frame_swap_message_queue_(new FrameSwapMessageQueue()), |
| 527 resizing_mode_selector_(new ResizingModeSelector()), | 529 resizing_mode_selector_(new ResizingModeSelector()), |
| 528 context_menu_source_type_(ui::MENU_SOURCE_MOUSE), | 530 context_menu_source_type_(ui::MENU_SOURCE_MOUSE), |
| 529 has_host_context_menu_location_(false) { | 531 has_host_context_menu_location_(false) { |
| 532 // base::debug::StackTrace().Print(); |
| 530 if (!swapped_out) | 533 if (!swapped_out) |
| 531 RenderProcess::current()->AddRefProcess(); | 534 RenderProcess::current()->AddRefProcess(); |
| 532 DCHECK(RenderThread::Get()); | 535 DCHECK(RenderThread::Get()); |
| 533 device_color_profile_.push_back('0'); | 536 device_color_profile_.push_back('0'); |
| 534 #if defined(OS_ANDROID) | 537 #if defined(OS_ANDROID) |
| 535 text_input_info_history_.push_back(blink::WebTextInputInfo()); | 538 text_input_info_history_.push_back(blink::WebTextInputInfo()); |
| 536 #endif | 539 #endif |
| 537 | 540 |
| 538 // In tests there may not be a RenderThreadImpl. | 541 // In tests there may not be a RenderThreadImpl. |
| 539 if (RenderThreadImpl::current()) { | 542 if (RenderThreadImpl::current()) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 567 return NULL; | 570 return NULL; |
| 568 } | 571 } |
| 569 | 572 |
| 570 // static | 573 // static |
| 571 RenderWidget* RenderWidget::CreateForFrame( | 574 RenderWidget* RenderWidget::CreateForFrame( |
| 572 int routing_id, | 575 int routing_id, |
| 573 bool hidden, | 576 bool hidden, |
| 574 const blink::WebScreenInfo& screen_info, | 577 const blink::WebScreenInfo& screen_info, |
| 575 CompositorDependencies* compositor_deps, | 578 CompositorDependencies* compositor_deps, |
| 576 blink::WebLocalFrame* frame) { | 579 blink::WebLocalFrame* frame) { |
| 580 // base::debug::StackTrace().Print(); |
| 577 CHECK_NE(routing_id, MSG_ROUTING_NONE); | 581 CHECK_NE(routing_id, MSG_ROUTING_NONE); |
| 578 // TODO(avi): Before RenderViewImpl has-a RenderWidget, the browser passes the | 582 // TODO(avi): Before RenderViewImpl has-a RenderWidget, the browser passes the |
| 579 // same routing ID for both the view routing ID and the main frame widget | 583 // same routing ID for both the view routing ID and the main frame widget |
| 580 // routing ID. https://crbug.com/545684 | 584 // routing ID. https://crbug.com/545684 |
| 581 RenderViewImpl* view = RenderViewImpl::FromRoutingID(routing_id); | 585 RenderViewImpl* view = RenderViewImpl::FromRoutingID(routing_id); |
| 582 if (view) { | 586 if (view) { |
| 583 view->AttachWebFrameWidget(RenderWidget::CreateWebFrameWidget(view, frame)); | 587 view->AttachWebFrameWidget(RenderWidget::CreateWebFrameWidget(view, frame)); |
| 584 return view; | 588 return view; |
| 585 } | 589 } |
| 586 scoped_refptr<RenderWidget> widget( | 590 scoped_refptr<RenderWidget> widget( |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 void RenderWidget::OnRequestMoveAck() { | 1000 void RenderWidget::OnRequestMoveAck() { |
| 997 DCHECK(pending_window_rect_count_); | 1001 DCHECK(pending_window_rect_count_); |
| 998 pending_window_rect_count_--; | 1002 pending_window_rect_count_--; |
| 999 } | 1003 } |
| 1000 | 1004 |
| 1001 GURL RenderWidget::GetURLForGraphicsContext3D() { | 1005 GURL RenderWidget::GetURLForGraphicsContext3D() { |
| 1002 return GURL(); | 1006 return GURL(); |
| 1003 } | 1007 } |
| 1004 | 1008 |
| 1005 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { | 1009 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { |
| 1010 RenderWidgetMusConnection* connection = |
| 1011 RenderWidgetMusConnection::Get(routing_id_); |
| 1012 fprintf(stderr, "EEE %s connection=%p\n", __func__, connection); |
| 1013 if (connection) { |
| 1014 return connection->CreateOutputSurface(); |
| 1015 } |
| 1016 |
| 1006 // For widgets that are never visible, we don't start the compositor, so we | 1017 // For widgets that are never visible, we don't start the compositor, so we |
| 1007 // never get a request for a cc::OutputSurface. | 1018 // never get a request for a cc::OutputSurface. |
| 1008 DCHECK(!compositor_never_visible_); | 1019 DCHECK(!compositor_never_visible_); |
| 1009 | 1020 |
| 1010 const base::CommandLine& command_line = | 1021 const base::CommandLine& command_line = |
| 1011 *base::CommandLine::ForCurrentProcess(); | 1022 *base::CommandLine::ForCurrentProcess(); |
| 1012 bool use_software = fallback; | 1023 bool use_software = fallback; |
| 1013 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) | 1024 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) |
| 1014 use_software = true; | 1025 use_software = true; |
| 1015 | 1026 |
| (...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2451 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2462 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2452 video_hole_frames_.AddObserver(frame); | 2463 video_hole_frames_.AddObserver(frame); |
| 2453 } | 2464 } |
| 2454 | 2465 |
| 2455 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2466 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2456 video_hole_frames_.RemoveObserver(frame); | 2467 video_hole_frames_.RemoveObserver(frame); |
| 2457 } | 2468 } |
| 2458 #endif // defined(VIDEO_HOLE) | 2469 #endif // defined(VIDEO_HOLE) |
| 2459 | 2470 |
| 2460 } // namespace content | 2471 } // namespace content |
| OLD | NEW |