| 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 "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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone) | 124 DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone) |
| 125 << "If running tests, ensure that main() is calling " | 125 << "If running tests, ensure that main() is calling " |
| 126 << "gl::GLSurfaceTestSupport::InitializeOneOff()"; | 126 << "gl::GLSurfaceTestSupport::InitializeOneOff()"; |
| 127 } | 127 } |
| 128 | 128 |
| 129 InProcessContextFactory::~InProcessContextFactory() { | 129 InProcessContextFactory::~InProcessContextFactory() { |
| 130 DCHECK(per_compositor_data_.empty()); | 130 DCHECK(per_compositor_data_.empty()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void InProcessContextFactory::SendOnLostResources() { | 133 void InProcessContextFactory::SendOnLostResources() { |
| 134 FOR_EACH_OBSERVER(ContextFactoryObserver, observer_list_, OnLostResources()); | 134 for (auto& observer : observer_list_) |
| 135 observer.OnLostResources(); |
| 135 } | 136 } |
| 136 | 137 |
| 137 void InProcessContextFactory::CreateCompositorFrameSink( | 138 void InProcessContextFactory::CreateCompositorFrameSink( |
| 138 base::WeakPtr<Compositor> compositor) { | 139 base::WeakPtr<Compositor> compositor) { |
| 139 // Try to reuse existing shared worker context provider. | 140 // Try to reuse existing shared worker context provider. |
| 140 bool shared_worker_context_provider_lost = false; | 141 bool shared_worker_context_provider_lost = false; |
| 141 if (shared_worker_context_provider_) { | 142 if (shared_worker_context_provider_) { |
| 142 // Note: If context is lost, delete reference after releasing the lock. | 143 // Note: If context is lost, delete reference after releasing the lock. |
| 143 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); | 144 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); |
| 144 if (shared_worker_context_provider_->ContextGL() | 145 if (shared_worker_context_provider_->ContextGL() |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 281 |
| 281 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { | 282 void InProcessContextFactory::AddObserver(ContextFactoryObserver* observer) { |
| 282 observer_list_.AddObserver(observer); | 283 observer_list_.AddObserver(observer); |
| 283 } | 284 } |
| 284 | 285 |
| 285 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { | 286 void InProcessContextFactory::RemoveObserver(ContextFactoryObserver* observer) { |
| 286 observer_list_.RemoveObserver(observer); | 287 observer_list_.RemoveObserver(observer); |
| 287 } | 288 } |
| 288 | 289 |
| 289 } // namespace ui | 290 } // namespace ui |
| OLD | NEW |