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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 12717013: Add reference-counting for mailbox textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add optional 'pool' reference while textures are in mailbox Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 on_compositing_did_commit_callbacks_.push_back( 1556 on_compositing_did_commit_callbacks_.push_back(
1557 base::Bind(&RenderWidgetHostViewAura:: 1557 base::Bind(&RenderWidgetHostViewAura::
1558 SetSurfaceNotInUseByCompositor, 1558 SetSurfaceNotInUseByCompositor,
1559 AsWeakPtr(), 1559 AsWeakPtr(),
1560 current_surface_)); // Hold a ref so the texture will not 1560 current_surface_)); // Hold a ref so the texture will not
1561 // get deleted until after commit. 1561 // get deleted until after commit.
1562 if (!compositor->HasObserver(this)) 1562 if (!compositor->HasObserver(this))
1563 compositor->AddObserver(this); 1563 compositor->AddObserver(this);
1564 } 1564 }
1565 current_surface_ = NULL; 1565 current_surface_ = NULL;
1566 LOG(INFO) << "Releasing frontbuffer";
1566 UpdateExternalTexture(); 1567 UpdateExternalTexture();
1567 } 1568 }
1568 } 1569 }
1569 1570
1570 bool RenderWidgetHostViewAura::HasAcceleratedSurface( 1571 bool RenderWidgetHostViewAura::HasAcceleratedSurface(
1571 const gfx::Size& desired_size) { 1572 const gfx::Size& desired_size) {
1572 // Aura doesn't use GetBackingStore for accelerated pages, so it doesn't 1573 // Aura doesn't use GetBackingStore for accelerated pages, so it doesn't
1573 // matter what is returned here as GetBackingStore is the only caller of this 1574 // matter what is returned here as GetBackingStore is the only caller of this
1574 // method. TODO(jbates) implement this if other Aura code needs it. 1575 // method. TODO(jbates) implement this if other Aura code needs it.
1575 return false; 1576 return false;
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 UpdateExternalTexture(); 2463 UpdateExternalTexture();
2463 locks_pending_commit_.clear(); 2464 locks_pending_commit_.clear();
2464 2465
2465 // Make sure all ImageTransportClients are deleted now that the context those 2466 // Make sure all ImageTransportClients are deleted now that the context those
2466 // are using is becoming invalid. This sends pending ACKs and needs to happen 2467 // are using is becoming invalid. This sends pending ACKs and needs to happen
2467 // after calling UpdateExternalTexture() which syncs with the impl thread. 2468 // after calling UpdateExternalTexture() which syncs with the impl thread.
2468 RunCompositingDidCommitCallbacks(); 2469 RunCompositingDidCommitCallbacks();
2469 2470
2470 DCHECK(!shared_surface_handle_.is_null()); 2471 DCHECK(!shared_surface_handle_.is_null());
2471 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 2472 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
2472 factory->DestroySharedSurfaceHandle(shared_surface_handle_); 2473 factory->DestroySharedSurfaceHandle(shared_surface_handle_,
2474 host_->surface_id());
2473 shared_surface_handle_ = factory->CreateSharedSurfaceHandle(); 2475 shared_surface_handle_ = factory->CreateSharedSurfaceHandle();
2474 host_->CompositingSurfaceUpdated(); 2476 host_->CompositingSurfaceUpdated();
2475 host_->ScheduleComposite(); 2477 host_->ScheduleComposite();
2476 } 2478 }
2477 2479
2478 //////////////////////////////////////////////////////////////////////////////// 2480 ////////////////////////////////////////////////////////////////////////////////
2479 // RenderWidgetHostViewAura, private: 2481 // RenderWidgetHostViewAura, private:
2480 2482
2481 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { 2483 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
2482 if (paint_observer_) 2484 if (paint_observer_)
2483 paint_observer_->OnViewDestroyed(); 2485 paint_observer_->OnViewDestroyed();
2484 if (!shared_surface_handle_.is_null()) { 2486 if (!shared_surface_handle_.is_null()) {
2485 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 2487 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
2486 factory->DestroySharedSurfaceHandle(shared_surface_handle_); 2488 factory->DestroySharedSurfaceHandle(shared_surface_handle_,
2489 host_->surface_id());
2487 factory->RemoveObserver(this); 2490 factory->RemoveObserver(this);
2488 } 2491 }
2489 window_observer_.reset(); 2492 window_observer_.reset();
2490 #if defined(OS_WIN) 2493 #if defined(OS_WIN)
2491 transient_observer_.reset(); 2494 transient_observer_.reset();
2492 #endif 2495 #endif
2493 if (window_->GetRootWindow()) 2496 if (window_->GetRootWindow())
2494 window_->GetRootWindow()->RemoveRootWindowObserver(this); 2497 window_->GetRootWindow()->RemoveRootWindowObserver(this);
2495 UnlockMouse(); 2498 UnlockMouse();
2496 if (popup_type_ != WebKit::WebPopupTypeNone && popup_parent_host_view_) { 2499 if (popup_type_ != WebKit::WebPopupTypeNone && popup_parent_host_view_) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 RenderWidgetHost* widget) { 2678 RenderWidgetHost* widget) {
2676 return new RenderWidgetHostViewAura(widget); 2679 return new RenderWidgetHostViewAura(widget);
2677 } 2680 }
2678 2681
2679 // static 2682 // static
2680 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2683 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
2681 GetScreenInfoForWindow(results, NULL); 2684 GetScreenInfoForWindow(results, NULL);
2682 } 2685 }
2683 2686
2684 } // namespace content 2687 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/image_transport_factory.cc ('k') | content/common/gpu/gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698