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_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
6 | 6 |
7 #include "cc/surfaces/surface.h" | 7 #include "cc/surfaces/surface.h" |
8 #include "cc/surfaces/surface_factory.h" | 8 #include "cc/surfaces/surface_factory.h" |
9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
10 #include "cc/surfaces/surface_sequence.h" | 10 #include "cc/surfaces/surface_sequence.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 | 243 |
244 // Check whether we need to recreate the cc::Surface, which means the child | 244 // Check whether we need to recreate the cc::Surface, which means the child |
245 // frame renderer has changed its output surface, or size, or scale factor. | 245 // frame renderer has changed its output surface, or size, or scale factor. |
246 if (output_surface_id != last_output_surface_id_ && surface_factory_) { | 246 if (output_surface_id != last_output_surface_id_ && surface_factory_) { |
247 surface_factory_->Destroy(surface_id_); | 247 surface_factory_->Destroy(surface_id_); |
248 surface_factory_.reset(); | 248 surface_factory_.reset(); |
249 } | 249 } |
250 if (output_surface_id != last_output_surface_id_ || | 250 if (output_surface_id != last_output_surface_id_ || |
251 frame_size != current_surface_size_ || | 251 frame_size != current_surface_size_ || |
252 scale_factor != current_surface_scale_factor_) { | 252 scale_factor != current_surface_scale_factor_) { |
253 if (surface_factory_ && !surface_id_.is_null()) | 253 ClearCompositorSurfaceIfNecessary(); |
254 surface_factory_->Destroy(surface_id_); | |
255 surface_id_ = cc::SurfaceId(); | |
256 last_output_surface_id_ = output_surface_id; | 254 last_output_surface_id_ = output_surface_id; |
257 current_surface_size_ = frame_size; | 255 current_surface_size_ = frame_size; |
258 current_surface_scale_factor_ = scale_factor; | 256 current_surface_scale_factor_ = scale_factor; |
259 } | 257 } |
260 | 258 |
261 if (!surface_factory_) { | 259 if (!surface_factory_) { |
262 cc::SurfaceManager* manager = GetSurfaceManager(); | 260 cc::SurfaceManager* manager = GetSurfaceManager(); |
263 surface_factory_ = make_scoped_ptr(new cc::SurfaceFactory(manager, this)); | 261 surface_factory_ = make_scoped_ptr(new cc::SurfaceFactory(manager, this)); |
264 } | 262 } |
265 | 263 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 std::back_inserter(surface_returned_resources_)); | 409 std::back_inserter(surface_returned_resources_)); |
412 } | 410 } |
413 | 411 |
414 BrowserAccessibilityManager* | 412 BrowserAccessibilityManager* |
415 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( | 413 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( |
416 BrowserAccessibilityDelegate* delegate) { | 414 BrowserAccessibilityDelegate* delegate) { |
417 return BrowserAccessibilityManager::Create( | 415 return BrowserAccessibilityManager::Create( |
418 BrowserAccessibilityManager::GetEmptyDocument(), delegate); | 416 BrowserAccessibilityManager::GetEmptyDocument(), delegate); |
419 } | 417 } |
420 | 418 |
419 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | |
420 if (surface_factory_ && !surface_id_.is_null()) | |
421 surface_factory_->Destroy(surface_id_); | |
lazyboy
2015/06/26 18:03:21
nit: indent
wjmaclean
2015/06/27 16:30:58
Done.
| |
422 surface_id_ = cc::SurfaceId(); | |
423 } | |
424 | |
421 } // namespace content | 425 } // namespace content |
OLD | NEW |