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

Side by Side Diff: cc/test/fake_context_provider.h

Issue 21026005: aura: Remove CreateOffscreenContext from ui::ContextFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: offscreencontext: clang-format Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/texture_layer_unittest.cc ('k') | cc/test/fake_context_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_TEST_FAKE_CONTEXT_PROVIDER_H_
6 #define CC_TEST_FAKE_CONTEXT_PROVIDER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h"
11 #include "base/threading/thread_checker.h"
12 #include "cc/output/context_provider.h"
13
14 namespace cc {
15 class TestWebGraphicsContext3D;
16
17 class FakeContextProvider : public cc::ContextProvider {
18 public:
19 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)>
20 CreateCallback;
21
22 static scoped_refptr<FakeContextProvider> Create() {
23 return Create(CreateCallback());
24 }
25
26 static scoped_refptr<FakeContextProvider> Create(
27 const CreateCallback& create_callback) {
28 scoped_refptr<FakeContextProvider> provider = new FakeContextProvider;
29 if (!provider->InitializeOnMainThread(create_callback))
30 return NULL;
31 return provider;
32 }
33
34 virtual bool BindToCurrentThread() OVERRIDE;
35 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
36 virtual class GrContext* GrContext() OVERRIDE;
37 virtual void VerifyContexts() OVERRIDE;
38 virtual bool DestroyedOnMainThread() OVERRIDE;
39 virtual void SetLostContextCallback(const LostContextCallback& cb) OVERRIDE;
40
41 protected:
42 FakeContextProvider();
43 virtual ~FakeContextProvider();
44
45 bool InitializeOnMainThread(const CreateCallback& create_callback);
46
47 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
48 bool bound_;
49
50 base::ThreadChecker main_thread_checker_;
51 base::ThreadChecker context_thread_checker_;
52
53 base::Lock destroyed_lock_;
54 bool destroyed_;
55 };
56
57 } // namespace cc
58
59 #endif // CC_TEST_FAKE_CONTEXT_PROVIDER_H_
60
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_unittest.cc ('k') | cc/test/fake_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698