| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 current_surface_size_ = frame_size; | 301 current_surface_size_ = frame_size; |
| 302 current_surface_scale_factor_ = scale_factor; | 302 current_surface_scale_factor_ = scale_factor; |
| 303 } | 303 } |
| 304 | 304 |
| 305 if (!surface_factory_) { | 305 if (!surface_factory_) { |
| 306 cc::SurfaceManager* manager = GetSurfaceManager(); | 306 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 307 surface_factory_ = | 307 surface_factory_ = |
| 308 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); | 308 base::MakeUnique<cc::SurfaceFactory>(frame_sink_id_, manager, this); |
| 309 } | 309 } |
| 310 | 310 |
| 311 if (local_frame_id_.is_null()) { | 311 if (!local_frame_id_.is_valid()) { |
| 312 local_frame_id_ = id_allocator_->GenerateId(); | 312 local_frame_id_ = id_allocator_->GenerateId(); |
| 313 surface_factory_->Create(local_frame_id_); | 313 surface_factory_->Create(local_frame_id_); |
| 314 | 314 |
| 315 cc::SurfaceSequence sequence = | 315 cc::SurfaceSequence sequence = |
| 316 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); | 316 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); |
| 317 // The renderer process will satisfy this dependency when it creates a | 317 // The renderer process will satisfy this dependency when it creates a |
| 318 // SurfaceLayer. | 318 // SurfaceLayer. |
| 319 cc::SurfaceManager* manager = GetSurfaceManager(); | 319 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 320 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 320 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); |
| 321 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); | 321 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 gesture_event.data.scrollUpdate.inertialPhase == | 689 gesture_event.data.scrollUpdate.inertialPhase == |
| 690 blink::WebGestureEvent::MomentumPhase) { | 690 blink::WebGestureEvent::MomentumPhase) { |
| 691 return; | 691 return; |
| 692 } | 692 } |
| 693 host_->ForwardGestureEvent(gesture_event); | 693 host_->ForwardGestureEvent(gesture_event); |
| 694 return; | 694 return; |
| 695 } | 695 } |
| 696 } | 696 } |
| 697 | 697 |
| 698 } // namespace content | 698 } // namespace content |
| OLD | NEW |