| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 return; | 116 return; |
| 117 // Make sure the size of this view matches the size of the WebContentsView. | 117 // Make sure the size of this view matches the size of the WebContentsView. |
| 118 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, | 118 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, |
| 119 // resize, and then switch page, as is the case with interstitial pages. | 119 // resize, and then switch page, as is the case with interstitial pages. |
| 120 // NOTE: |guest_| is NULL in unit tests. | 120 // NOTE: |guest_| is NULL in unit tests. |
| 121 if (guest_) { | 121 if (guest_) { |
| 122 SetSize(guest_->web_contents()->GetViewBounds().size()); | 122 SetSize(guest_->web_contents()->GetViewBounds().size()); |
| 123 // Since we were last shown, our renderer may have had a different surface | 123 // Since we were last shown, our renderer may have had a different surface |
| 124 // set (e.g. showing an interstitial), so we resend our current surface to | 124 // set (e.g. showing an interstitial), so we resend our current surface to |
| 125 // the renderer. | 125 // the renderer. |
| 126 if (!local_frame_id_.is_null()) { | 126 if (local_frame_id_.is_valid()) { |
| 127 cc::SurfaceSequence sequence = | 127 cc::SurfaceSequence sequence = |
| 128 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); | 128 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); |
| 129 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 129 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); |
| 130 GetSurfaceManager() | 130 GetSurfaceManager() |
| 131 ->GetSurfaceForId(surface_id) | 131 ->GetSurfaceForId(surface_id) |
| 132 ->AddDestructionDependency(sequence); | 132 ->AddDestructionDependency(sequence); |
| 133 guest_->SetChildFrameSurface(surface_id, current_surface_size_, | 133 guest_->SetChildFrameSurface(surface_id, current_surface_size_, |
| 134 current_surface_scale_factor_, sequence); | 134 current_surface_scale_factor_, sequence); |
| 135 } | 135 } |
| 136 } | 136 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 current_surface_size_ = frame_size; | 300 current_surface_size_ = frame_size; |
| 301 current_surface_scale_factor_ = scale_factor; | 301 current_surface_scale_factor_ = scale_factor; |
| 302 } | 302 } |
| 303 | 303 |
| 304 if (!surface_factory_) { | 304 if (!surface_factory_) { |
| 305 cc::SurfaceManager* manager = GetSurfaceManager(); | 305 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 306 surface_factory_ = | 306 surface_factory_ = |
| 307 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); | 307 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); |
| 308 } | 308 } |
| 309 | 309 |
| 310 if (local_frame_id_.is_null()) { | 310 if (!local_frame_id_.is_valid()) { |
| 311 local_frame_id_ = id_allocator_->GenerateId(); | 311 local_frame_id_ = id_allocator_->GenerateId(); |
| 312 surface_factory_->Create(local_frame_id_); | 312 surface_factory_->Create(local_frame_id_); |
| 313 | 313 |
| 314 cc::SurfaceSequence sequence = | 314 cc::SurfaceSequence sequence = |
| 315 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); | 315 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); |
| 316 // The renderer process will satisfy this dependency when it creates a | 316 // The renderer process will satisfy this dependency when it creates a |
| 317 // SurfaceLayer. | 317 // SurfaceLayer. |
| 318 cc::SurfaceManager* manager = GetSurfaceManager(); | 318 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 319 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 319 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); |
| 320 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); | 320 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 gesture_event.data.scrollUpdate.inertialPhase == | 688 gesture_event.data.scrollUpdate.inertialPhase == |
| 689 blink::WebGestureEvent::MomentumPhase) { | 689 blink::WebGestureEvent::MomentumPhase) { |
| 690 return; | 690 return; |
| 691 } | 691 } |
| 692 host_->ForwardGestureEvent(gesture_event); | 692 host_->ForwardGestureEvent(gesture_event); |
| 693 return; | 693 return; |
| 694 } | 694 } |
| 695 } | 695 } |
| 696 | 696 |
| 697 } // namespace content | 697 } // namespace content |
| OLD | NEW |