Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 1199963011: Force new surface on BrowserPluginGuest reattach. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test, and add check for null surface id in test. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_);
422 surface_id_ = cc::SurfaceId();
423 }
424
421 } // namespace content 425 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698