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

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: rebase 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
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 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(
30 const CreateCallback& create_callback) {
31 scoped_refptr<FakeContextProvider> provider =
32 new FakeContextProvider;
33 if (!provider->InitializeOnMainThread(create_callback))
34 return NULL;
35 return provider;
36 }
37
38 virtual bool BindToCurrentThread() OVERRIDE;
39 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
40 virtual class GrContext* GrContext() OVERRIDE;
41 virtual void VerifyContexts() OVERRIDE;
42 virtual bool DestroyedOnMainThread() OVERRIDE;
43 virtual void SetLostContextCallback(const LostContextCallback& cb) OVERRIDE;
44
45 protected:
46 FakeContextProvider();
47 virtual ~FakeContextProvider();
48
49 bool InitializeOnMainThread(const CreateCallback& create_callback);
50
51 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_;
52 bool bound_;
53
54 base::ThreadChecker main_thread_checker_;
55 base::ThreadChecker context_thread_checker_;
56
57 base::Lock destroyed_lock_;
58 bool destroyed_;
59 };
60
61 } // namespace cc
62
63 #endif // CC_TEST_FAKE_CONTEXT_PROVIDER_H_
64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698