| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/render_widget_host_view_guest.h" | 5 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, | 108 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, |
| 109 // resize, and then switch page, as is the case with interstitial pages. | 109 // resize, and then switch page, as is the case with interstitial pages. |
| 110 // NOTE: |guest_| is NULL in unit tests. | 110 // NOTE: |guest_| is NULL in unit tests. |
| 111 if (guest_) { | 111 if (guest_) { |
| 112 SetSize(guest_->web_contents()->GetViewBounds().size()); | 112 SetSize(guest_->web_contents()->GetViewBounds().size()); |
| 113 // Since we were last shown, our renderer may have had a different surface | 113 // Since we were last shown, our renderer may have had a different surface |
| 114 // set (e.g. showing an interstitial), so we resend our current surface to | 114 // set (e.g. showing an interstitial), so we resend our current surface to |
| 115 // the renderer. | 115 // the renderer. |
| 116 if (!surface_id_.is_null()) { | 116 if (!surface_id_.is_null()) { |
| 117 cc::SurfaceSequence sequence = cc::SurfaceSequence( | 117 cc::SurfaceSequence sequence = cc::SurfaceSequence( |
| 118 id_allocator_->id_namespace(), next_surface_sequence_++); | 118 id_allocator_->client_id(), next_surface_sequence_++); |
| 119 GetSurfaceManager() | 119 GetSurfaceManager() |
| 120 ->GetSurfaceForId(surface_id_) | 120 ->GetSurfaceForId(surface_id_) |
| 121 ->AddDestructionDependency(sequence); | 121 ->AddDestructionDependency(sequence); |
| 122 guest_->SetChildFrameSurface(surface_id_, current_surface_size_, | 122 guest_->SetChildFrameSurface(surface_id_, current_surface_size_, |
| 123 current_surface_scale_factor_, | 123 current_surface_scale_factor_, |
| 124 sequence); | 124 sequence); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 host_->WasShown(ui::LatencyInfo()); | 127 host_->WasShown(ui::LatencyInfo()); |
| 128 } | 128 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if (!surface_factory_) { | 288 if (!surface_factory_) { |
| 289 cc::SurfaceManager* manager = GetSurfaceManager(); | 289 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 290 surface_factory_ = base::WrapUnique(new cc::SurfaceFactory(manager, this)); | 290 surface_factory_ = base::WrapUnique(new cc::SurfaceFactory(manager, this)); |
| 291 } | 291 } |
| 292 | 292 |
| 293 if (surface_id_.is_null()) { | 293 if (surface_id_.is_null()) { |
| 294 surface_id_ = id_allocator_->GenerateId(); | 294 surface_id_ = id_allocator_->GenerateId(); |
| 295 surface_factory_->Create(surface_id_); | 295 surface_factory_->Create(surface_id_); |
| 296 | 296 |
| 297 cc::SurfaceSequence sequence = cc::SurfaceSequence( | 297 cc::SurfaceSequence sequence = cc::SurfaceSequence( |
| 298 id_allocator_->id_namespace(), next_surface_sequence_++); | 298 id_allocator_->client_id(), next_surface_sequence_++); |
| 299 // The renderer process will satisfy this dependency when it creates a | 299 // The renderer process will satisfy this dependency when it creates a |
| 300 // SurfaceLayer. | 300 // SurfaceLayer. |
| 301 cc::SurfaceManager* manager = GetSurfaceManager(); | 301 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 302 manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence); | 302 manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence); |
| 303 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, | 303 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, |
| 304 sequence); | 304 sequence); |
| 305 } | 305 } |
| 306 | 306 |
| 307 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( | 307 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( |
| 308 &RenderWidgetHostViewChildFrame::SurfaceDrawn, | 308 &RenderWidgetHostViewChildFrame::SurfaceDrawn, |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 gesture_event.data.scrollUpdate.inertialPhase == | 620 gesture_event.data.scrollUpdate.inertialPhase == |
| 621 blink::WebGestureEvent::MomentumPhase) { | 621 blink::WebGestureEvent::MomentumPhase) { |
| 622 return; | 622 return; |
| 623 } | 623 } |
| 624 host_->ForwardGestureEvent(gesture_event); | 624 host_->ForwardGestureEvent(gesture_event); |
| 625 return; | 625 return; |
| 626 } | 626 } |
| 627 } | 627 } |
| 628 | 628 |
| 629 } // namespace content | 629 } // namespace content |
| OLD | NEW |