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

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

Issue 111063003: Aura: Don't create GL context for CreateSharedSurfaceHandle() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 aura::client::SetTooltipText(window_, &tooltip_); 479 aura::client::SetTooltipText(window_, &tooltip_);
480 aura::client::SetActivationDelegate(window_, this); 480 aura::client::SetActivationDelegate(window_, this);
481 aura::client::SetActivationChangeObserver(window_, this); 481 aura::client::SetActivationChangeObserver(window_, this);
482 aura::client::SetFocusChangeObserver(window_, this); 482 aura::client::SetFocusChangeObserver(window_, this);
483 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 483 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
484 software_frame_manager_.reset(new SoftwareFrameManager( 484 software_frame_manager_.reset(new SoftwareFrameManager(
485 weak_ptr_factory_.GetWeakPtr())); 485 weak_ptr_factory_.GetWeakPtr()));
486 #if defined(OS_WIN) 486 #if defined(OS_WIN)
487 plugin_parent_window_ = NULL; 487 plugin_parent_window_ = NULL;
488 #endif 488 #endif
489 ImageTransportFactory::GetInstance()->AddObserver(this);
489 } 490 }
490 491
491 //////////////////////////////////////////////////////////////////////////////// 492 ////////////////////////////////////////////////////////////////////////////////
492 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 493 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
493 494
494 void RenderWidgetHostViewAura::InitAsChild( 495 void RenderWidgetHostViewAura::InitAsChild(
495 gfx::NativeView parent_view) { 496 gfx::NativeView parent_view) {
496 window_->Init(ui::LAYER_TEXTURED); 497 window_->Init(ui::LAYER_TEXTURED);
497 window_->SetName("RenderWidgetHostViewAura"); 498 window_->SetName("RenderWidgetHostViewAura");
498 } 499 }
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 2128
2128 void RenderWidgetHostViewAura::OnAccessibilityEvents( 2129 void RenderWidgetHostViewAura::OnAccessibilityEvents(
2129 const std::vector<AccessibilityHostMsg_EventParams>& params) { 2130 const std::vector<AccessibilityHostMsg_EventParams>& params) {
2130 BrowserAccessibilityManager* manager = 2131 BrowserAccessibilityManager* manager =
2131 GetOrCreateBrowserAccessibilityManager(); 2132 GetOrCreateBrowserAccessibilityManager();
2132 if (manager) 2133 if (manager)
2133 manager->OnAccessibilityEvents(params); 2134 manager->OnAccessibilityEvents(params);
2134 } 2135 }
2135 2136
2136 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { 2137 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
2137 if (shared_surface_handle_.is_null()) { 2138 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
2138 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
2139 shared_surface_handle_ = factory->CreateSharedSurfaceHandle();
2140 if (!shared_surface_handle_.is_null())
2141 factory->AddObserver(this);
2142 }
2143 return shared_surface_handle_;
2144 } 2139 }
2145 2140
2146 bool RenderWidgetHostViewAura::LockMouse() { 2141 bool RenderWidgetHostViewAura::LockMouse() {
2147 aura::Window* root_window = window_->GetRootWindow(); 2142 aura::Window* root_window = window_->GetRootWindow();
2148 if (!root_window) 2143 if (!root_window)
2149 return false; 2144 return false;
2150 2145
2151 if (mouse_locked_) 2146 if (mouse_locked_)
2152 return true; 2147 return true;
2153 2148
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 void RenderWidgetHostViewAura::OnLostResources() { 3190 void RenderWidgetHostViewAura::OnLostResources() {
3196 current_surface_ = NULL; 3191 current_surface_ = NULL;
3197 UpdateExternalTexture(); 3192 UpdateExternalTexture();
3198 3193
3199 idle_frame_subscriber_textures_.clear(); 3194 idle_frame_subscriber_textures_.clear();
3200 3195
3201 // Make sure all ImageTransportClients are deleted now that the context those 3196 // Make sure all ImageTransportClients are deleted now that the context those
3202 // are using is becoming invalid. This sends pending ACKs and needs to happen 3197 // are using is becoming invalid. This sends pending ACKs and needs to happen
3203 // after calling UpdateExternalTexture() which syncs with the impl thread. 3198 // after calling UpdateExternalTexture() which syncs with the impl thread.
3204 RunOnCommitCallbacks(); 3199 RunOnCommitCallbacks();
3205
3206 DCHECK(!shared_surface_handle_.is_null());
3207 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
3208 factory->DestroySharedSurfaceHandle(shared_surface_handle_);
3209 shared_surface_handle_ = factory->CreateSharedSurfaceHandle();
3210 host_->CompositingSurfaceUpdated();
3211 host_->ScheduleComposite(); 3200 host_->ScheduleComposite();
3212 } 3201 }
3213 3202
3214 //////////////////////////////////////////////////////////////////////////////// 3203 ////////////////////////////////////////////////////////////////////////////////
3215 // RenderWidgetHostViewAura, private: 3204 // RenderWidgetHostViewAura, private:
3216 3205
3217 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { 3206 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
3218 if (paint_observer_) 3207 if (paint_observer_)
3219 paint_observer_->OnViewDestroyed(); 3208 paint_observer_->OnViewDestroyed();
3220 if (touch_editing_client_) 3209 if (touch_editing_client_)
3221 touch_editing_client_->OnViewDestroyed(); 3210 touch_editing_client_->OnViewDestroyed();
3222 if (!shared_surface_handle_.is_null()) { 3211
3223 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 3212 ImageTransportFactory::GetInstance()->RemoveObserver(this);
3224 factory->DestroySharedSurfaceHandle(shared_surface_handle_); 3213
3225 factory->RemoveObserver(this);
3226 }
3227 window_observer_.reset(); 3214 window_observer_.reset();
3228 if (window_->GetDispatcher()) 3215 if (window_->GetDispatcher())
3229 window_->GetDispatcher()->RemoveRootWindowObserver(this); 3216 window_->GetDispatcher()->RemoveRootWindowObserver(this);
3230 UnlockMouse(); 3217 UnlockMouse();
3231 if (popup_parent_host_view_) { 3218 if (popup_parent_host_view_) {
3232 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || 3219 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL ||
3233 popup_parent_host_view_->popup_child_host_view_ == this); 3220 popup_parent_host_view_->popup_child_host_view_ == this);
3234 popup_parent_host_view_->popup_child_host_view_ = NULL; 3221 popup_parent_host_view_->popup_child_host_view_ = NULL;
3235 } 3222 }
3236 if (popup_child_host_view_) { 3223 if (popup_child_host_view_) {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 RenderWidgetHost* widget) { 3451 RenderWidgetHost* widget) {
3465 return new RenderWidgetHostViewAura(widget); 3452 return new RenderWidgetHostViewAura(widget);
3466 } 3453 }
3467 3454
3468 // static 3455 // static
3469 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3456 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3470 GetScreenInfoForWindow(results, NULL); 3457 GetScreenInfoForWindow(results, NULL);
3471 } 3458 }
3472 3459
3473 } // namespace content 3460 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698