| 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 |
| 20 : public NON_EXPORTED_BASE(cc::ContextProvider) { |
| 18 public: | 21 public: |
| 19 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> | 22 typedef base::Callback<scoped_ptr<WebKit::WebGraphicsContext3D>(void)> |
| 20 CreateCallback; | 23 CreateCallback; |
| 21 | 24 |
| 22 static scoped_refptr<FakeContextProvider> Create() { | 25 static scoped_refptr<FakeContextProvider> Create() { |
| 23 return Create(CreateCallback()); | 26 return Create(CreateCallback()); |
| 24 } | 27 } |
| 25 | 28 |
| 26 static scoped_refptr<FakeContextProvider> Create( | 29 static scoped_refptr<FakeContextProvider> Create( |
| 27 const CreateCallback& create_callback) { | 30 const CreateCallback& create_callback) { |
| 28 scoped_refptr<FakeContextProvider> provider = new FakeContextProvider; | 31 scoped_refptr<FakeContextProvider> provider = new FakeContextProvider; |
| 29 if (!provider->InitializeOnMainThread(create_callback)) | 32 if (!provider->InitializeOnMainThread(create_callback)) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 | 52 |
| 50 base::ThreadChecker main_thread_checker_; | 53 base::ThreadChecker main_thread_checker_; |
| 51 base::ThreadChecker context_thread_checker_; | 54 base::ThreadChecker context_thread_checker_; |
| 52 | 55 |
| 53 base::Lock destroyed_lock_; | 56 base::Lock destroyed_lock_; |
| 54 bool destroyed_; | 57 bool destroyed_; |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace cc | 60 } // namespace cc |
| 58 | 61 |
| 59 #endif // CC_TEST_FAKE_CONTEXT_PROVIDER_H_ | 62 #endif // CC_DEBUG_FAKE_CONTEXT_PROVIDER_H_ |
| 60 | 63 |
| OLD | NEW |