| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 ClearCompositorSurfaceIfNecessary(); | 293 ClearCompositorSurfaceIfNecessary(); |
| 294 // If the renderer changed its frame sink, reset the surface factory to | 294 // If the renderer changed its frame sink, reset the surface factory to |
| 295 // avoid returning stale resources. | 295 // avoid returning stale resources. |
| 296 if (compositor_frame_sink_id != last_compositor_frame_sink_id_) | 296 if (compositor_frame_sink_id != last_compositor_frame_sink_id_) |
| 297 surface_factory_->Reset(); | 297 surface_factory_->Reset(); |
| 298 last_compositor_frame_sink_id_ = compositor_frame_sink_id; | 298 last_compositor_frame_sink_id_ = compositor_frame_sink_id; |
| 299 current_surface_size_ = frame_size; | 299 current_surface_size_ = frame_size; |
| 300 current_surface_scale_factor_ = scale_factor; | 300 current_surface_scale_factor_ = scale_factor; |
| 301 } | 301 } |
| 302 | 302 |
| 303 if (local_frame_id_.is_null()) { | 303 if (!local_frame_id_.is_valid()) { |
| 304 local_frame_id_ = id_allocator_->GenerateId(); | 304 local_frame_id_ = id_allocator_->GenerateId(); |
| 305 surface_factory_->Create(local_frame_id_); | 305 surface_factory_->Create(local_frame_id_); |
| 306 | 306 |
| 307 cc::SurfaceSequence sequence = | 307 cc::SurfaceSequence sequence = |
| 308 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); | 308 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); |
| 309 // The renderer process will satisfy this dependency when it creates a | 309 // The renderer process will satisfy this dependency when it creates a |
| 310 // SurfaceLayer. | 310 // SurfaceLayer. |
| 311 cc::SurfaceManager* manager = GetSurfaceManager(); | 311 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 312 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); | 312 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); |
| 313 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); | 313 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 gesture_event.data.scrollUpdate.inertialPhase == | 681 gesture_event.data.scrollUpdate.inertialPhase == |
| 682 blink::WebGestureEvent::MomentumPhase) { | 682 blink::WebGestureEvent::MomentumPhase) { |
| 683 return; | 683 return; |
| 684 } | 684 } |
| 685 host_->ForwardGestureEvent(gesture_event); | 685 host_->ForwardGestureEvent(gesture_event); |
| 686 return; | 686 return; |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 | 689 |
| 690 } // namespace content | 690 } // namespace content |
| OLD | NEW |