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 |
325 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 332 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
326 surface_id_, GetCompositingSurface()); | 333 surface_id_, GetCompositingSurface()); |
327 | 334 |
328 synthetic_gesture_controller_.reset(); | 335 synthetic_gesture_controller_.reset(); |
329 } | 336 } |
330 | 337 |
331 RenderProcessHost* RenderWidgetHostImpl::GetProcess() const { | 338 RenderProcessHost* RenderWidgetHostImpl::GetProcess() const { |
332 return process_; | 339 return process_; |
333 } | 340 } |
334 | 341 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 416 |
410 renderer_initialized_ = true; | 417 renderer_initialized_ = true; |
411 | 418 |
412 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 419 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
413 surface_id_, GetCompositingSurface()); | 420 surface_id_, GetCompositingSurface()); |
414 | 421 |
415 // Send the ack along with the information on placement. | 422 // Send the ack along with the information on placement. |
416 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); | 423 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); |
417 GetProcess()->ResumeRequestsForView(routing_id_); | 424 GetProcess()->ResumeRequestsForView(routing_id_); |
418 | 425 |
| 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 |
419 WasResized(); | 433 WasResized(); |
420 } | 434 } |
421 | 435 |
422 void RenderWidgetHostImpl::InitForFrame() { | 436 void RenderWidgetHostImpl::InitForFrame() { |
423 DCHECK(process_->HasConnection()); | 437 DCHECK(process_->HasConnection()); |
424 renderer_initialized_ = true; | 438 renderer_initialized_ = true; |
425 } | 439 } |
426 | 440 |
427 void RenderWidgetHostImpl::Shutdown() { | 441 void RenderWidgetHostImpl::Shutdown() { |
428 RejectMouseLockOrUnlockIfNecessary(); | 442 RejectMouseLockOrUnlockIfNecessary(); |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 } | 2133 } |
2120 #endif | 2134 #endif |
2121 | 2135 |
2122 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2136 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2123 if (view_) | 2137 if (view_) |
2124 return view_->PreferredReadbackFormat(); | 2138 return view_->PreferredReadbackFormat(); |
2125 return kN32_SkColorType; | 2139 return kN32_SkColorType; |
2126 } | 2140 } |
2127 | 2141 |
2128 } // namespace content | 2142 } // namespace content |
OLD | NEW |