Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: content/renderer/render_widget.cc

Issue 10441101: Revert 124453 - WebWidgetClient::screenInfo() no longer does a synchronous IPC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: perged Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 using WebKit::WebRect; 65 using WebKit::WebRect;
66 using WebKit::WebScreenInfo; 66 using WebKit::WebScreenInfo;
67 using WebKit::WebSize; 67 using WebKit::WebSize;
68 using WebKit::WebTextDirection; 68 using WebKit::WebTextDirection;
69 using WebKit::WebTouchEvent; 69 using WebKit::WebTouchEvent;
70 using WebKit::WebVector; 70 using WebKit::WebVector;
71 using WebKit::WebWidget; 71 using WebKit::WebWidget;
72 using content::RenderThread; 72 using content::RenderThread;
73 73
74 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, 74 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type,
75 const WebKit::WebScreenInfo& screen_info,
76 bool swapped_out) 75 bool swapped_out)
77 : routing_id_(MSG_ROUTING_NONE), 76 : routing_id_(MSG_ROUTING_NONE),
78 surface_id_(0), 77 surface_id_(0),
79 webwidget_(NULL), 78 webwidget_(NULL),
80 opener_id_(MSG_ROUTING_NONE), 79 opener_id_(MSG_ROUTING_NONE),
81 host_window_(0), 80 host_window_(0),
82 host_window_set_(false), 81 host_window_set_(false),
83 current_paint_buf_(NULL), 82 current_paint_buf_(NULL),
84 next_paint_flags_(0), 83 next_paint_flags_(0),
85 filtered_time_per_frame_(0.0f), 84 filtered_time_per_frame_(0.0f),
(...skipping 11 matching lines...) Expand all
97 is_swapped_out_(swapped_out), 96 is_swapped_out_(swapped_out),
98 input_method_is_active_(false), 97 input_method_is_active_(false),
99 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 98 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
100 can_compose_inline_(true), 99 can_compose_inline_(true),
101 popup_type_(popup_type), 100 popup_type_(popup_type),
102 pending_window_rect_count_(0), 101 pending_window_rect_count_(0),
103 suppress_next_char_events_(false), 102 suppress_next_char_events_(false),
104 is_accelerated_compositing_active_(false), 103 is_accelerated_compositing_active_(false),
105 animation_update_pending_(false), 104 animation_update_pending_(false),
106 invalidation_task_posted_(false), 105 invalidation_task_posted_(false),
107 screen_info_(screen_info),
108 invert_(false) { 106 invert_(false) {
109 if (!swapped_out) 107 if (!swapped_out)
110 RenderProcess::current()->AddRefProcess(); 108 RenderProcess::current()->AddRefProcess();
111 DCHECK(RenderThread::Get()); 109 DCHECK(RenderThread::Get());
112 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( 110 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch(
113 switches::kDisableGpuVsync); 111 switches::kDisableGpuVsync);
114 } 112 }
115 113
116 RenderWidget::~RenderWidget() { 114 RenderWidget::~RenderWidget() {
117 DCHECK(!webwidget_) << "Leaking our WebWidget!"; 115 DCHECK(!webwidget_) << "Leaking our WebWidget!";
118 STLDeleteElements(&updates_pending_swap_); 116 STLDeleteElements(&updates_pending_swap_);
119 if (current_paint_buf_) { 117 if (current_paint_buf_) {
120 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); 118 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_);
121 current_paint_buf_ = NULL; 119 current_paint_buf_ = NULL;
122 } 120 }
123 // If we are swapped out, we have released already. 121 // If we are swapped out, we have released already.
124 if (!is_swapped_out_) 122 if (!is_swapped_out_)
125 RenderProcess::current()->ReleaseProcess(); 123 RenderProcess::current()->ReleaseProcess();
126 } 124 }
127 125
128 // static 126 // static
129 RenderWidget* RenderWidget::Create(int32 opener_id, 127 RenderWidget* RenderWidget::Create(int32 opener_id,
130 WebKit::WebPopupType popup_type, 128 WebKit::WebPopupType popup_type) {
131 const WebKit::WebScreenInfo& screen_info) {
132 DCHECK(opener_id != MSG_ROUTING_NONE); 129 DCHECK(opener_id != MSG_ROUTING_NONE);
133 scoped_refptr<RenderWidget> widget( 130 scoped_refptr<RenderWidget> widget(
134 new RenderWidget(popup_type, screen_info, false)); 131 new RenderWidget(popup_type, false));
135 widget->Init(opener_id); // adds reference 132 widget->Init(opener_id); // adds reference
136 return widget; 133 return widget;
137 } 134 }
138 135
139 // static 136 // static
140 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) { 137 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) {
141 switch (render_widget->popup_type_) { 138 switch (render_widget->popup_type_) {
142 case WebKit::WebPopupTypeNone: // Nothing to create. 139 case WebKit::WebPopupTypeNone: // Nothing to create.
143 break; 140 break;
144 case WebKit::WebPopupTypeSelect: 141 case WebKit::WebPopupTypeSelect:
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 return static_cast<ui::TextInputType>(type); 1651 return static_cast<ui::TextInputType>(type);
1655 } 1652 }
1656 return ui::TEXT_INPUT_TYPE_NONE; 1653 return ui::TEXT_INPUT_TYPE_NONE;
1657 } 1654 }
1658 1655
1659 bool RenderWidget::CanComposeInline() { 1656 bool RenderWidget::CanComposeInline() {
1660 return true; 1657 return true;
1661 } 1658 }
1662 1659
1663 WebScreenInfo RenderWidget::screenInfo() { 1660 WebScreenInfo RenderWidget::screenInfo() {
1664 return screen_info_; 1661 WebScreenInfo results;
1662 if (host_window_set_)
1663 Send(new ViewHostMsg_GetScreenInfo(routing_id_, host_window_, &results));
1664 else {
1665 DLOG(WARNING) << "Unable to retrieve screen information, no host window";
1666 #if defined(USE_AURA)
1667 // TODO(backer): Remove this a temporary workaround for crbug.com/111929
1668 // once we get a proper fix.
1669 results.availableRect.width = 1000;
1670 results.availableRect.height = 1000;
1671 #endif
1672 }
1673 return results;
1665 } 1674 }
1666 1675
1667 void RenderWidget::resetInputMethod() { 1676 void RenderWidget::resetInputMethod() {
1668 if (!input_method_is_active_) 1677 if (!input_method_is_active_)
1669 return; 1678 return;
1670 1679
1671 // If the last text input type is not None, then we should finish any 1680 // If the last text input type is not None, then we should finish any
1672 // ongoing composition regardless of the new text input type. 1681 // ongoing composition regardless of the new text input type.
1673 if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) { 1682 if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) {
1674 // If a composition text exists, then we need to let the browser process 1683 // If a composition text exists, then we need to let the browser process
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 } 1724 }
1716 } 1725 }
1717 1726
1718 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1727 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1719 return false; 1728 return false;
1720 } 1729 }
1721 1730
1722 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1731 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1723 return false; 1732 return false;
1724 } 1733 }
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698