| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/test/test_context_provider_factory.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "cc/output/context_provider.h" | |
| 9 #include "webkit/common/gpu/context_provider_in_process.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 static TestContextProviderFactory* context_provider_instance = NULL; | |
| 14 | |
| 15 // static | |
| 16 TestContextProviderFactory* TestContextProviderFactory::GetInstance() { | |
| 17 if (!context_provider_instance) | |
| 18 context_provider_instance = new TestContextProviderFactory(); | |
| 19 return context_provider_instance; | |
| 20 } | |
| 21 | |
| 22 TestContextProviderFactory::TestContextProviderFactory() {} | |
| 23 | |
| 24 TestContextProviderFactory::~TestContextProviderFactory() {} | |
| 25 | |
| 26 scoped_refptr<cc::ContextProvider> TestContextProviderFactory:: | |
| 27 OffscreenContextProviderForMainThread() { | |
| 28 if (!main_thread_.get() || main_thread_->DestroyedOnMainThread()) { | |
| 29 bool lose_context_when_out_of_memory = false; | |
| 30 main_thread_ = webkit::gpu::ContextProviderInProcess::CreateOffscreen( | |
| 31 lose_context_when_out_of_memory); | |
| 32 if (main_thread_.get() && !main_thread_->BindToCurrentThread()) | |
| 33 main_thread_ = NULL; | |
| 34 } | |
| 35 return main_thread_; | |
| 36 } | |
| 37 | |
| 38 } // namespace content | |
| OLD | NEW |