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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
(...skipping 77 matching lines...) Loading... | |
88 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the | 88 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the |
89 // first place: http://crbug.com/273089. | 89 // first place: http://crbug.com/273089. |
90 // | 90 // |
91 // |guest_| is NULL during test. | 91 // |guest_| is NULL during test. |
92 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) | 92 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) |
93 return; | 93 return; |
94 // Make sure the size of this view matches the size of the WebContentsView. | 94 // Make sure the size of this view matches the size of the WebContentsView. |
95 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, | 95 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, |
96 // resize, and then switch page, as is the case with interstitial pages. | 96 // resize, and then switch page, as is the case with interstitial pages. |
97 // NOTE: |guest_| is NULL in unit tests. | 97 // NOTE: |guest_| is NULL in unit tests. |
98 if (guest_) | 98 if (guest_) { |
99 SetSize(guest_->web_contents()->GetViewBounds().size()); | 99 SetSize(guest_->web_contents()->GetViewBounds().size()); |
100 if (!surface_id_.is_null()) { | |
101 guest_->SetChildFrameSurface(surface_id_, current_surface_size_, | |
102 current_surface_scale_factor_, | |
103 surface_sequence_); | |
kenrb
2015/11/25 21:44:02
I wonder if it might be safer to destroy any exist
wjmaclean
2015/11/25 21:50:17
Acknowledged.
| |
104 } | |
105 } | |
100 host_->WasShown(ui::LatencyInfo()); | 106 host_->WasShown(ui::LatencyInfo()); |
101 } | 107 } |
102 | 108 |
103 void RenderWidgetHostViewGuest::Hide() { | 109 void RenderWidgetHostViewGuest::Hide() { |
104 // |guest_| is NULL during test. | 110 // |guest_| is NULL during test. |
105 if ((guest_ && guest_->is_in_destruction()) || host_->is_hidden()) | 111 if ((guest_ && guest_->is_in_destruction()) || host_->is_hidden()) |
106 return; | 112 return; |
107 host_->WasHidden(); | 113 host_->WasHidden(); |
108 } | 114 } |
109 | 115 |
(...skipping 138 matching lines...) Loading... | |
248 | 254 |
249 if (!surface_factory_) { | 255 if (!surface_factory_) { |
250 cc::SurfaceManager* manager = GetSurfaceManager(); | 256 cc::SurfaceManager* manager = GetSurfaceManager(); |
251 surface_factory_ = make_scoped_ptr(new cc::SurfaceFactory(manager, this)); | 257 surface_factory_ = make_scoped_ptr(new cc::SurfaceFactory(manager, this)); |
252 } | 258 } |
253 | 259 |
254 if (surface_id_.is_null()) { | 260 if (surface_id_.is_null()) { |
255 surface_id_ = id_allocator_->GenerateId(); | 261 surface_id_ = id_allocator_->GenerateId(); |
256 surface_factory_->Create(surface_id_); | 262 surface_factory_->Create(surface_id_); |
257 | 263 |
258 cc::SurfaceSequence sequence = cc::SurfaceSequence( | 264 surface_sequence_ = cc::SurfaceSequence( |
259 id_allocator_->id_namespace(), next_surface_sequence_++); | 265 id_allocator_->id_namespace(), surface_sequence_.sequence + 1); |
260 // The renderer process will satisfy this dependency when it creates a | 266 // The renderer process will satisfy this dependency when it creates a |
261 // SurfaceLayer. | 267 // SurfaceLayer. |
262 cc::SurfaceManager* manager = GetSurfaceManager(); | 268 cc::SurfaceManager* manager = GetSurfaceManager(); |
263 manager->GetSurfaceForId(surface_id_)->AddDestructionDependency(sequence); | 269 manager->GetSurfaceForId(surface_id_) |
270 ->AddDestructionDependency(surface_sequence_); | |
264 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, | 271 guest_->SetChildFrameSurface(surface_id_, frame_size, scale_factor, |
265 sequence); | 272 surface_sequence_); |
266 } | 273 } |
267 | 274 |
268 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( | 275 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( |
269 &RenderWidgetHostViewChildFrame::SurfaceDrawn, | 276 &RenderWidgetHostViewChildFrame::SurfaceDrawn, |
270 RenderWidgetHostViewChildFrame::AsWeakPtr(), output_surface_id); | 277 RenderWidgetHostViewChildFrame::AsWeakPtr(), output_surface_id); |
271 ack_pending_count_++; | 278 ack_pending_count_++; |
272 // If this value grows very large, something is going wrong. | 279 // If this value grows very large, something is going wrong. |
273 DCHECK(ack_pending_count_ < 1000); | 280 DCHECK(ack_pending_count_ < 1000); |
274 surface_factory_->SubmitCompositorFrame(surface_id_, frame.Pass(), | 281 surface_factory_->SubmitCompositorFrame(surface_id_, frame.Pass(), |
275 ack_callback); | 282 ack_callback); |
(...skipping 441 matching lines...) Loading... | |
717 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate && | 724 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate && |
718 gesture_event.data.scrollUpdate.inertial) { | 725 gesture_event.data.scrollUpdate.inertial) { |
719 return; | 726 return; |
720 } | 727 } |
721 host_->ForwardGestureEvent(gesture_event); | 728 host_->ForwardGestureEvent(gesture_event); |
722 return; | 729 return; |
723 } | 730 } |
724 } | 731 } |
725 | 732 |
726 } // namespace content | 733 } // namespace content |
OLD | NEW |