| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CC_TEST_FAKE_CONTEXT_PROVIDER_H_ | 5 #ifndef CC_DEBUG_FAKE_CONTEXT_PROVIDER_H_ |
| 6 #define CC_TEST_FAKE_CONTEXT_PROVIDER_H_ | 6 #define CC_DEBUG_FAKE_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "cc/base/cc_export.h" |
| 12 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 13 | 14 |
| 15 namespace WebKit { class WebGraphicsContext3D; } |
| 16 |
| 14 namespace cc { | 17 namespace cc { |
| 15 class TestWebGraphicsContext3D; | |
| 16 | 18 |
| 17 class FakeContextProvider : public cc::ContextProvider { | 19 class CC_EXPORT FakeContextProvider : public cc::ContextProvider { |
| 18 public: | 20 public: |
| 19 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> | 21 typedef base::Callback<scoped_ptr<WebKit::WebGraphicsContext3D>(void)> |
| 20 CreateCallback; | 22 CreateCallback; |
| 21 | 23 |
| 22 static scoped_refptr<FakeContextProvider> Create() { | |
| 23 scoped_refptr<FakeContextProvider> provider = new FakeContextProvider(); | |
| 24 if (!provider->InitializeOnMainThread(CreateCallback())) | |
| 25 return NULL; | |
| 26 return provider; | |
| 27 } | |
| 28 | |
| 29 static scoped_refptr<FakeContextProvider> Create( | 24 static scoped_refptr<FakeContextProvider> Create( |
| 30 const CreateCallback& create_callback) { | 25 const CreateCallback& create_callback) { |
| 31 scoped_refptr<FakeContextProvider> provider = | 26 scoped_refptr<FakeContextProvider> provider = |
| 32 new FakeContextProvider; | 27 new FakeContextProvider; |
| 33 if (!provider->InitializeOnMainThread(create_callback)) | 28 if (!provider->InitializeOnMainThread(create_callback)) |
| 34 return NULL; | 29 return NULL; |
| 35 return provider; | 30 return provider; |
| 36 } | 31 } |
| 37 | 32 |
| 38 virtual bool BindToCurrentThread() OVERRIDE; | 33 virtual bool BindToCurrentThread() OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 53 | 48 |
| 54 base::ThreadChecker main_thread_checker_; | 49 base::ThreadChecker main_thread_checker_; |
| 55 base::ThreadChecker context_thread_checker_; | 50 base::ThreadChecker context_thread_checker_; |
| 56 | 51 |
| 57 base::Lock destroyed_lock_; | 52 base::Lock destroyed_lock_; |
| 58 bool destroyed_; | 53 bool destroyed_; |
| 59 }; | 54 }; |
| 60 | 55 |
| 61 } // namespace cc | 56 } // namespace cc |
| 62 | 57 |
| 63 #endif // CC_TEST_FAKE_CONTEXT_PROVIDER_H_ | 58 #endif // CC_DEBUG_FAKE_CONTEXT_PROVIDER_H_ |
| 64 | 59 |
| OLD | NEW |