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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 1359163005: Remove surface_id from RenderWidget/RenderWidgetHost and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@channel_creation_preempt
Patch Set: fix more tests Created 5 years, 2 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
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/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 12 matching lines...) Expand all
23 #include "base/thread_task_runner_handle.h" 23 #include "base/thread_task_runner_handle.h"
24 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
25 #include "cc/base/switches.h" 25 #include "cc/base/switches.h"
26 #include "cc/output/compositor_frame.h" 26 #include "cc/output/compositor_frame.h"
27 #include "cc/output/compositor_frame_ack.h" 27 #include "cc/output/compositor_frame_ack.h"
28 #include "content/browser/accessibility/accessibility_mode_helper.h" 28 #include "content/browser/accessibility/accessibility_mode_helper.h"
29 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 29 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
30 #include "content/browser/bad_message.h" 30 #include "content/browser/bad_message.h"
31 #include "content/browser/browser_plugin/browser_plugin_guest.h" 31 #include "content/browser/browser_plugin/browser_plugin_guest.h"
32 #include "content/browser/gpu/compositor_util.h" 32 #include "content/browser/gpu/compositor_util.h"
33 #include "content/browser/gpu/gpu_process_host.h"
34 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
35 #include "content/browser/gpu/gpu_surface_tracker.h"
36 #include "content/browser/renderer_host/dip_util.h" 33 #include "content/browser/renderer_host/dip_util.h"
37 #include "content/browser/renderer_host/frame_metadata_util.h" 34 #include "content/browser/renderer_host/frame_metadata_util.h"
38 #include "content/browser/renderer_host/input/input_router_config_helper.h" 35 #include "content/browser/renderer_host/input/input_router_config_helper.h"
39 #include "content/browser/renderer_host/input/input_router_impl.h" 36 #include "content/browser/renderer_host/input/input_router_impl.h"
40 #include "content/browser/renderer_host/input/synthetic_gesture.h" 37 #include "content/browser/renderer_host/input/synthetic_gesture.h"
41 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" 38 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h"
42 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" 39 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
43 #include "content/browser/renderer_host/input/timeout_monitor.h" 40 #include "content/browser/renderer_host/input/timeout_monitor.h"
44 #include "content/browser/renderer_host/input/touch_emulator.h" 41 #include "content/browser/renderer_host/input/touch_emulator.h"
45 #include "content/browser/renderer_host/render_process_host_impl.h" 42 #include "content/browser/renderer_host/render_process_host_impl.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 }; 136 };
140 137
141 } // namespace 138 } // namespace
142 139
143 /////////////////////////////////////////////////////////////////////////////// 140 ///////////////////////////////////////////////////////////////////////////////
144 // RenderWidgetHostImpl 141 // RenderWidgetHostImpl
145 142
146 RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 143 RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
147 RenderProcessHost* process, 144 RenderProcessHost* process,
148 int32_t routing_id, 145 int32_t routing_id,
149 int32_t surface_id,
150 bool hidden) 146 bool hidden)
151 : view_(NULL), 147 : view_(NULL),
152 hung_renderer_delay_( 148 hung_renderer_delay_(
153 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 149 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
154 new_content_rendering_delay_( 150 new_content_rendering_delay_(
155 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)), 151 base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
156 renderer_initialized_(false), 152 renderer_initialized_(false),
157 delegate_(delegate), 153 delegate_(delegate),
158 process_(process), 154 process_(process),
159 routing_id_(routing_id), 155 routing_id_(routing_id),
160 surface_id_(surface_id),
161 is_loading_(false), 156 is_loading_(false),
162 is_hidden_(hidden), 157 is_hidden_(hidden),
163 repaint_ack_pending_(false), 158 repaint_ack_pending_(false),
164 resize_ack_pending_(false), 159 resize_ack_pending_(false),
165 color_profile_out_of_date_(false), 160 color_profile_out_of_date_(false),
166 auto_resize_enabled_(false), 161 auto_resize_enabled_(false),
167 waiting_for_screen_rects_ack_(false), 162 waiting_for_screen_rects_ack_(false),
168 needs_repainting_on_restore_(false), 163 needs_repainting_on_restore_(false),
169 is_unresponsive_(false), 164 is_unresponsive_(false),
170 in_flight_event_count_(0), 165 in_flight_event_count_(0),
171 in_get_backing_store_(false), 166 in_get_backing_store_(false),
172 ignore_input_events_(false), 167 ignore_input_events_(false),
173 text_direction_updated_(false), 168 text_direction_updated_(false),
174 text_direction_(blink::WebTextDirectionLeftToRight), 169 text_direction_(blink::WebTextDirectionLeftToRight),
175 text_direction_canceled_(false), 170 text_direction_canceled_(false),
176 suppress_next_char_events_(false), 171 suppress_next_char_events_(false),
177 pending_mouse_lock_request_(false), 172 pending_mouse_lock_request_(false),
178 allow_privileged_mouse_lock_(false), 173 allow_privileged_mouse_lock_(false),
179 has_touch_handler_(false), 174 has_touch_handler_(false),
180 next_browser_snapshot_id_(1), 175 next_browser_snapshot_id_(1),
181 owned_by_render_frame_host_(false), 176 owned_by_render_frame_host_(false),
182 is_focused_(false), 177 is_focused_(false),
183 weak_factory_(this) { 178 weak_factory_(this) {
184 CHECK(delegate_); 179 CHECK(delegate_);
185 CHECK_NE(MSG_ROUTING_NONE, routing_id_); 180 CHECK_NE(MSG_ROUTING_NONE, routing_id_);
186 DCHECK_EQ(surface_id_, GpuSurfaceTracker::Get()->LookupSurfaceForRenderer(
187 process_->GetID(), routing_id_));
188 181
189 std::pair<RoutingIDWidgetMap::iterator, bool> result = 182 std::pair<RoutingIDWidgetMap::iterator, bool> result =
190 g_routing_id_widget_map.Get().insert(std::make_pair( 183 g_routing_id_widget_map.Get().insert(std::make_pair(
191 RenderWidgetHostID(process->GetID(), routing_id_), this)); 184 RenderWidgetHostID(process->GetID(), routing_id_), this));
192 CHECK(result.second) << "Inserting a duplicate item!"; 185 CHECK(result.second) << "Inserting a duplicate item!";
193 process_->AddRoute(routing_id_, this); 186 process_->AddRoute(routing_id_, this);
194 187
195 // If we're initially visible, tell the process host that we're alive. 188 // If we're initially visible, tell the process host that we're alive.
196 // Otherwise we'll notify the process host when we are first shown. 189 // Otherwise we'll notify the process host when we are first shown.
197 if (!hidden) 190 if (!hidden)
(...skipping 19 matching lines...) Expand all
217 new_content_rendering_timeout_.reset(new TimeoutMonitor( 210 new_content_rendering_timeout_.reset(new TimeoutMonitor(
218 base::Bind(&RenderWidgetHostImpl::ClearDisplayedGraphics, 211 base::Bind(&RenderWidgetHostImpl::ClearDisplayedGraphics,
219 weak_factory_.GetWeakPtr()))); 212 weak_factory_.GetWeakPtr())));
220 } 213 }
221 214
222 RenderWidgetHostImpl::~RenderWidgetHostImpl() { 215 RenderWidgetHostImpl::~RenderWidgetHostImpl() {
223 if (view_weak_) 216 if (view_weak_)
224 view_weak_->RenderWidgetHostGone(); 217 view_weak_->RenderWidgetHostGone();
225 SetView(NULL); 218 SetView(NULL);
226 219
227 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_);
228 surface_id_ = 0;
229
230 process_->RemoveRoute(routing_id_); 220 process_->RemoveRoute(routing_id_);
231 g_routing_id_widget_map.Get().erase( 221 g_routing_id_widget_map.Get().erase(
232 RenderWidgetHostID(process_->GetID(), routing_id_)); 222 RenderWidgetHostID(process_->GetID(), routing_id_));
233 223
234 if (delegate_) 224 if (delegate_)
235 delegate_->RenderWidgetDeleted(this); 225 delegate_->RenderWidgetDeleted(this);
236 } 226 }
237 227
238 // static 228 // static
239 RenderWidgetHost* RenderWidgetHost::FromID( 229 RenderWidgetHost* RenderWidgetHost::FromID(
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 } 2135 }
2146 2136
2147 #if defined(OS_WIN) 2137 #if defined(OS_WIN)
2148 gfx::NativeViewAccessible 2138 gfx::NativeViewAccessible
2149 RenderWidgetHostImpl::GetParentNativeViewAccessible() { 2139 RenderWidgetHostImpl::GetParentNativeViewAccessible() {
2150 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; 2140 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL;
2151 } 2141 }
2152 #endif 2142 #endif
2153 2143
2154 } // namespace content 2144 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698