| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, | 107 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, |
| 108 // resize, and then switch page, as is the case with interstitial pages. | 108 // resize, and then switch page, as is the case with interstitial pages. |
| 109 // NOTE: |guest_| is NULL in unit tests. | 109 // NOTE: |guest_| is NULL in unit tests. |
| 110 if (guest_) { | 110 if (guest_) { |
| 111 SetSize(guest_->web_contents()->GetViewBounds().size()); | 111 SetSize(guest_->web_contents()->GetViewBounds().size()); |
| 112 // Since we were last shown, our renderer may have had a different surface | 112 // Since we were last shown, our renderer may have had a different surface |
| 113 // set (e.g. showing an interstitial), so we resend our current surface to | 113 // set (e.g. showing an interstitial), so we resend our current surface to |
| 114 // the renderer. | 114 // the renderer. |
| 115 if (!surface_id_.is_null()) { | 115 if (!surface_id_.is_null()) { |
| 116 cc::SurfaceSequence sequence = cc::SurfaceSequence( | 116 cc::SurfaceSequence sequence = cc::SurfaceSequence( |
| 117 id_allocator_->client_id(), next_surface_sequence_++); | 117 id_allocator_->frame_sink_id(), next_surface_sequence_++); |
| 118 GetSurfaceManager() | 118 GetSurfaceManager() |
| 119 ->GetSurfaceForId(surface_id_) | 119 ->GetSurfaceForId(surface_id_) |
| 120 ->AddDestructionDependency(sequence); | 120 ->AddDestructionDependency(sequence); |
| 121 guest_->SetChildFrameSurface(surface_id_, current_surface_size_, | 121 guest_->SetChildFrameSurface(surface_id_, current_surface_size_, |
| 122 current_surface_scale_factor_, | 122 current_surface_scale_factor_, |
| 123 sequence); | 123 sequence); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 host_->WasShown(ui::LatencyInfo()); | 126 host_->WasShown(ui::LatencyInfo()); |
| 127 } | 127 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (!surface_factory_) { | 294 if (!surface_factory_) { |
| 295 cc::SurfaceManager* manager = GetSurfaceManager(); | 295 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 296 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(manager, this); | 296 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(manager, this); |
| 297 } | 297 } |
| 298 | 298 |
| 299 if (surface_id_.is_null()) { | 299 if (surface_id_.is_null()) { |
| 300 surface_id_ = id_allocator_->GenerateId(); | 300 surface_id_ = id_allocator_->GenerateId(); |
| 301 surface_factory_->Create(surface_id_); | 301 surface_factory_->Create(surface_id_); |
| 302 | 302 |
| 303 cc::SurfaceSequence sequence = cc::SurfaceSequence( | 303 cc::SurfaceSequence sequence = cc::SurfaceSequence( |
| 304 id_allocator_->client_id(), next_surface_sequence_++); | 304 id_allocator_->frame_sink_id(), next_surface_sequence_++); |
| 305 // The renderer process will satisfy this dependency when it creates a | 305 // The renderer process will satisfy this dependency when it creates a |
| 306 // SurfaceLayer. | 306 // SurfaceLayer. |
| 307 cc::SurfaceManager* manager = GetSurfaceManager(); | 307 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 308 manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence); | 308 manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence); |
| 309 // TODO(wjmaclean): I'm not sure what it means to create a surface id | 309 // TODO(wjmaclean): I'm not sure what it means to create a surface id |
| 310 // without setting it on the child, though since we will in this case be | 310 // without setting it on the child, though since we will in this case be |
| 311 // guaranteed to call ClearCompositorSurfaceIfNecessary() below, I suspect | 311 // guaranteed to call ClearCompositorSurfaceIfNecessary() below, I suspect |
| 312 // skipping SetChildFrameSurface() here is irrelevant. | 312 // skipping SetChildFrameSurface() here is irrelevant. |
| 313 if (guest_ && !guest_->is_in_destruction()) { | 313 if (guest_ && !guest_->is_in_destruction()) { |
| 314 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, | 314 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 gesture_event.data.scrollUpdate.inertialPhase == | 676 gesture_event.data.scrollUpdate.inertialPhase == |
| 677 blink::WebGestureEvent::MomentumPhase) { | 677 blink::WebGestureEvent::MomentumPhase) { |
| 678 return; | 678 return; |
| 679 } | 679 } |
| 680 host_->ForwardGestureEvent(gesture_event); | 680 host_->ForwardGestureEvent(gesture_event); |
| 681 return; | 681 return; |
| 682 } | 682 } |
| 683 } | 683 } |
| 684 | 684 |
| 685 } // namespace content | 685 } // namespace content |
| OLD | NEW |