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

Side by Side Diff: ui/compositor/test/in_process_context_factory.cc

Issue 2083853002: exo: Recreate Surface resources on context lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 4 years, 6 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
« no previous file with comments | « ui/compositor/test/in_process_context_factory.h ('k') | ui/views/mus/surface_context_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/compositor/test/in_process_context_factory.h" 5 #include "ui/compositor/test/in_process_context_factory.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 surface_manager_(surface_manager) { 105 surface_manager_(surface_manager) {
106 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone) 106 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone)
107 << "If running tests, ensure that main() is calling " 107 << "If running tests, ensure that main() is calling "
108 << "gl::GLSurfaceTestSupport::InitializeOneOff()"; 108 << "gl::GLSurfaceTestSupport::InitializeOneOff()";
109 } 109 }
110 110
111 InProcessContextFactory::~InProcessContextFactory() { 111 InProcessContextFactory::~InProcessContextFactory() {
112 DCHECK(per_compositor_data_.empty()); 112 DCHECK(per_compositor_data_.empty());
113 } 113 }
114 114
115 void InProcessContextFactory::SendOnLostResources() {
116 FOR_EACH_OBSERVER(ContextFactoryObserver, observer_list_, OnLostResources());
117 }
118
115 void InProcessContextFactory::CreateOutputSurface( 119 void InProcessContextFactory::CreateOutputSurface(
116 base::WeakPtr<Compositor> compositor) { 120 base::WeakPtr<Compositor> compositor) {
117 // Try to reuse existing shared worker context provider. 121 // Try to reuse existing shared worker context provider.
118 bool shared_worker_context_provider_lost = false; 122 bool shared_worker_context_provider_lost = false;
119 if (shared_worker_context_provider_) { 123 if (shared_worker_context_provider_) {
120 // Note: If context is lost, delete reference after releasing the lock. 124 // Note: If context is lost, delete reference after releasing the lock.
121 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); 125 base::AutoLock lock(*shared_worker_context_provider_->GetLock());
122 if (shared_worker_context_provider_->ContextGL() 126 if (shared_worker_context_provider_->ContextGL()
123 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { 127 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
124 shared_worker_context_provider_lost = true; 128 shared_worker_context_provider_lost = true;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 return surface_manager_; 258 return surface_manager_;
255 } 259 }
256 260
257 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, 261 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor,
258 const gfx::Size& size) { 262 const gfx::Size& size) {
259 if (!per_compositor_data_.count(compositor)) 263 if (!per_compositor_data_.count(compositor))
260 return; 264 return;
261 per_compositor_data_[compositor]->Resize(size); 265 per_compositor_data_[compositor]->Resize(size);
262 } 266 }
263 267
268 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) {
269 observer_list_.AddObserver(observer);
270 }
271
272 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) {
273 observer_list_.RemoveObserver(observer);
274 }
275
264 } // namespace ui 276 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/in_process_context_factory.h ('k') | ui/views/mus/surface_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698