| 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_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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 return rwh->AsRenderWidgetHostImpl(); | 315 return rwh->AsRenderWidgetHostImpl(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { | 318 void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { |
| 319 if (view) | 319 if (view) |
| 320 view_weak_ = view->GetWeakPtr(); | 320 view_weak_ = view->GetWeakPtr(); |
| 321 else | 321 else |
| 322 view_weak_.reset(); | 322 view_weak_.reset(); |
| 323 view_ = view; | 323 view_ = view; |
| 324 | 324 |
| 325 // If the renderer has not yet been initialized, then the surface ID | |
| 326 // namespace will be sent during initialization. | |
| 327 if (view_ && renderer_initialized_) { | |
| 328 Send(new ViewMsg_SetSurfaceIdNamespace(routing_id_, | |
| 329 view_->GetSurfaceIdNamespace())); | |
| 330 } | |
| 331 | |
| 332 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 325 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 333 surface_id_, GetCompositingSurface()); | 326 surface_id_, GetCompositingSurface()); |
| 334 | 327 |
| 335 synthetic_gesture_controller_.reset(); | 328 synthetic_gesture_controller_.reset(); |
| 336 } | 329 } |
| 337 | 330 |
| 338 RenderProcessHost* RenderWidgetHostImpl::GetProcess() const { | 331 RenderProcessHost* RenderWidgetHostImpl::GetProcess() const { |
| 339 return process_; | 332 return process_; |
| 340 } | 333 } |
| 341 | 334 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 409 |
| 417 renderer_initialized_ = true; | 410 renderer_initialized_ = true; |
| 418 | 411 |
| 419 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 412 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
| 420 surface_id_, GetCompositingSurface()); | 413 surface_id_, GetCompositingSurface()); |
| 421 | 414 |
| 422 // Send the ack along with the information on placement. | 415 // Send the ack along with the information on placement. |
| 423 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); | 416 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); |
| 424 GetProcess()->ResumeRequestsForView(routing_id_); | 417 GetProcess()->ResumeRequestsForView(routing_id_); |
| 425 | 418 |
| 426 // If the RWHV has not yet been set, the surface ID namespace will get | |
| 427 // passed down by the call to SetView(). | |
| 428 if (view_) { | |
| 429 Send(new ViewMsg_SetSurfaceIdNamespace(routing_id_, | |
| 430 view_->GetSurfaceIdNamespace())); | |
| 431 } | |
| 432 | |
| 433 WasResized(); | 419 WasResized(); |
| 434 } | 420 } |
| 435 | 421 |
| 436 void RenderWidgetHostImpl::InitForFrame() { | 422 void RenderWidgetHostImpl::InitForFrame() { |
| 437 DCHECK(process_->HasConnection()); | 423 DCHECK(process_->HasConnection()); |
| 438 renderer_initialized_ = true; | 424 renderer_initialized_ = true; |
| 439 } | 425 } |
| 440 | 426 |
| 441 void RenderWidgetHostImpl::Shutdown() { | 427 void RenderWidgetHostImpl::Shutdown() { |
| 442 RejectMouseLockOrUnlockIfNecessary(); | 428 RejectMouseLockOrUnlockIfNecessary(); |
| (...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 } | 2119 } |
| 2134 #endif | 2120 #endif |
| 2135 | 2121 |
| 2136 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2122 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2137 if (view_) | 2123 if (view_) |
| 2138 return view_->PreferredReadbackFormat(); | 2124 return view_->PreferredReadbackFormat(); |
| 2139 return kN32_SkColorType; | 2125 return kN32_SkColorType; |
| 2140 } | 2126 } |
| 2141 | 2127 |
| 2142 } // namespace content | 2128 } // namespace content |
| OLD | NEW |