| 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_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 run_modal_opener_id_(MSG_ROUTING_NONE), | 197 run_modal_opener_id_(MSG_ROUTING_NONE), |
| 198 is_waiting_for_close_ack_(false), | 198 is_waiting_for_close_ack_(false), |
| 199 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 199 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 200 virtual_keyboard_requested_(false), | 200 virtual_keyboard_requested_(false), |
| 201 is_focused_element_editable_(false), | 201 is_focused_element_editable_(false), |
| 202 updating_web_preferences_(false), | 202 updating_web_preferences_(false), |
| 203 weak_factory_(this) { | 203 weak_factory_(this) { |
| 204 DCHECK(instance_.get()); | 204 DCHECK(instance_.get()); |
| 205 CHECK(delegate_); // http://crbug.com/82827 | 205 CHECK(delegate_); // http://crbug.com/82827 |
| 206 | 206 |
| 207 LOG(ERROR) << "RVH[" << this << "]::RVH: " |
| 208 << "(" << GetProcess()->GetID() << ", " << GetRoutingID() << ")"; |
| 209 |
| 207 GetProcess()->EnableSendQueue(); | 210 GetProcess()->EnableSendQueue(); |
| 208 | 211 |
| 209 if (ResourceDispatcherHostImpl::Get()) { | 212 if (ResourceDispatcherHostImpl::Get()) { |
| 210 bool has_active_audio = false; | 213 bool has_active_audio = false; |
| 211 if (has_initialized_audio_host) { | 214 if (has_initialized_audio_host) { |
| 212 scoped_refptr<AudioRendererHost> arh = | 215 scoped_refptr<AudioRendererHost> arh = |
| 213 static_cast<RenderProcessHostImpl*>(GetProcess()) | 216 static_cast<RenderProcessHostImpl*>(GetProcess()) |
| 214 ->audio_renderer_host(); | 217 ->audio_renderer_host(); |
| 215 if (arh.get()) | 218 if (arh.get()) |
| 216 has_active_audio = arh->RenderViewHasActiveAudio(GetRoutingID()); | 219 has_active_audio = arh->RenderViewHasActiveAudio(GetRoutingID()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 230 RenderViewHostImpl::~RenderViewHostImpl() { | 233 RenderViewHostImpl::~RenderViewHostImpl() { |
| 231 if (ResourceDispatcherHostImpl::Get()) { | 234 if (ResourceDispatcherHostImpl::Get()) { |
| 232 BrowserThread::PostTask( | 235 BrowserThread::PostTask( |
| 233 BrowserThread::IO, FROM_HERE, | 236 BrowserThread::IO, FROM_HERE, |
| 234 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, | 237 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, |
| 235 base::Unretained(ResourceDispatcherHostImpl::Get()), | 238 base::Unretained(ResourceDispatcherHostImpl::Get()), |
| 236 GetProcess()->GetID(), GetRoutingID())); | 239 GetProcess()->GetID(), GetRoutingID())); |
| 237 } | 240 } |
| 238 | 241 |
| 239 delegate_->RenderViewDeleted(this); | 242 delegate_->RenderViewDeleted(this); |
| 243 LOG(ERROR) << "RVH[" << this << "]::~RVH"; |
| 240 } | 244 } |
| 241 | 245 |
| 242 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { | 246 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { |
| 243 return delegate_; | 247 return delegate_; |
| 244 } | 248 } |
| 245 | 249 |
| 246 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const { | 250 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const { |
| 247 return instance_.get(); | 251 return instance_.get(); |
| 248 } | 252 } |
| 249 | 253 |
| 250 bool RenderViewHostImpl::CreateRenderView( | 254 bool RenderViewHostImpl::CreateRenderView( |
| 251 const base::string16& frame_name, | 255 const base::string16& frame_name, |
| 252 int opener_route_id, | 256 int opener_route_id, |
| 253 int proxy_route_id, | 257 int proxy_route_id, |
| 254 int32 max_page_id, | 258 int32 max_page_id, |
| 255 bool window_was_created_with_opener) { | 259 bool window_was_created_with_opener) { |
| 256 TRACE_EVENT0("renderer_host,navigation", | 260 TRACE_EVENT0("renderer_host,navigation", |
| 257 "RenderViewHostImpl::CreateRenderView"); | 261 "RenderViewHostImpl::CreateRenderView"); |
| 258 DCHECK(!IsRenderViewLive()) << "Creating view twice"; | 262 DCHECK(!IsRenderViewLive()) << "Creating view twice"; |
| 259 | 263 |
| 264 LOG(ERROR) << "RVH[" << this << "]::CreateRenderView: " |
| 265 << "(" << GetProcess()->GetID() << ", " << GetRoutingID() << ")"; |
| 266 |
| 260 // The process may (if we're sharing a process with another host that already | 267 // The process may (if we're sharing a process with another host that already |
| 261 // initialized it) or may not (we have our own process or the old process | 268 // initialized it) or may not (we have our own process or the old process |
| 262 // crashed) have been initialized. Calling Init multiple times will be | 269 // crashed) have been initialized. Calling Init multiple times will be |
| 263 // ignored, so this is safe. | 270 // ignored, so this is safe. |
| 264 if (!GetProcess()->Init()) | 271 if (!GetProcess()->Init()) |
| 265 return false; | 272 return false; |
| 266 DCHECK(GetProcess()->HasConnection()); | 273 DCHECK(GetProcess()->HasConnection()); |
| 267 DCHECK(GetProcess()->GetBrowserContext()); | 274 DCHECK(GetProcess()->GetBrowserContext()); |
| 268 | 275 |
| 269 renderer_initialized_ = true; | 276 renderer_initialized_ = true; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 SetInitialRenderSizeParams(params.initial_size); | 317 SetInitialRenderSizeParams(params.initial_size); |
| 311 | 318 |
| 312 // If it's enabled, tell the renderer to set up the Javascript bindings for | 319 // If it's enabled, tell the renderer to set up the Javascript bindings for |
| 313 // sending messages back to the browser. | 320 // sending messages back to the browser. |
| 314 if (GetProcess()->IsIsolatedGuest()) | 321 if (GetProcess()->IsIsolatedGuest()) |
| 315 DCHECK_EQ(0, enabled_bindings_); | 322 DCHECK_EQ(0, enabled_bindings_); |
| 316 Send(new ViewMsg_AllowBindings(GetRoutingID(), enabled_bindings_)); | 323 Send(new ViewMsg_AllowBindings(GetRoutingID(), enabled_bindings_)); |
| 317 // Let our delegate know that we created a RenderView. | 324 // Let our delegate know that we created a RenderView. |
| 318 delegate_->RenderViewCreated(this); | 325 delegate_->RenderViewCreated(this); |
| 319 | 326 |
| 327 RenderFrameHostImpl::FromID(GetProcess()->GetID(), main_frame_routing_id_) |
| 328 ->SetRenderFrameCreated(true); |
| 329 |
| 320 return true; | 330 return true; |
| 321 } | 331 } |
| 322 | 332 |
| 323 bool RenderViewHostImpl::IsRenderViewLive() const { | 333 bool RenderViewHostImpl::IsRenderViewLive() const { |
| 324 return GetProcess()->HasConnection() && renderer_initialized_; | 334 return GetProcess()->HasConnection() && renderer_initialized_; |
| 325 } | 335 } |
| 326 | 336 |
| 327 void RenderViewHostImpl::SyncRendererPrefs() { | 337 void RenderViewHostImpl::SyncRendererPrefs() { |
| 328 Send(new ViewMsg_SetRendererPrefs(GetRoutingID(), | 338 Send(new ViewMsg_SetRendererPrefs(GetRoutingID(), |
| 329 delegate_->GetRendererPrefs( | 339 delegate_->GetRendererPrefs( |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1474 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1465 | 1475 |
| 1466 frame_tree->ResetForMainFrameSwap(); | 1476 frame_tree->ResetForMainFrameSwap(); |
| 1467 } | 1477 } |
| 1468 | 1478 |
| 1469 void RenderViewHostImpl::SelectWordAroundCaret() { | 1479 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1470 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1480 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1471 } | 1481 } |
| 1472 | 1482 |
| 1473 } // namespace content | 1483 } // namespace content |
| OLD | NEW |