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

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

Issue 18796008: Implement shareResources==true in TestWebGraphicsContext3D (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 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
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 #include "cc/test/fake_context_provider.h" 5 #include "cc/test/fake_context_provider.h"
6 6
7 #include "cc/test/test_web_graphics_context_3d.h" 7 #include "cc/test/test_web_graphics_context_3d.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 FakeContextProvider::FakeContextProvider() 11 FakeContextProvider::FakeContextProvider()
12 : destroyed_(false) { 12 : destroyed_(false) {
13 } 13 }
14 14
15 FakeContextProvider::FakeContextProvider( 15 FakeContextProvider::FakeContextProvider(
16 const CreateCallback& create_callback) 16 const CreateCallback& create_callback)
17 : create_callback_(create_callback), 17 : create_callback_(create_callback),
18 bound_(false), 18 bound_(false),
19 destroyed_(false) { 19 destroyed_(false) {
20 } 20 }
21 21
22 FakeContextProvider::~FakeContextProvider() {} 22 FakeContextProvider::~FakeContextProvider() {}
23 23
24 bool FakeContextProvider::InitializeOnMainThread() { 24 bool FakeContextProvider::InitializeOnMainThread() {
25 DCHECK(!context3d_); 25 DCHECK(!context3d_);
26 26
27 if (create_callback_.is_null()) 27 if (create_callback_.is_null())
28 context3d_ = TestWebGraphicsContext3D::Create().Pass(); 28 context3d_ = TestWebGraphicsContext3D::CreateShared();
29 else 29 else
30 context3d_ = create_callback_.Run(); 30 context3d_ = create_callback_.Run();
31 return context3d_; 31 return context3d_;
32 } 32 }
33 33
34 bool FakeContextProvider::BindToCurrentThread() { 34 bool FakeContextProvider::BindToCurrentThread() {
35 bound_ = true; 35 bound_ = true;
36 if (!context3d_->makeContextCurrent()) { 36 if (!context3d_->makeContextCurrent()) {
37 base::AutoLock lock(destroyed_lock_); 37 base::AutoLock lock(destroyed_lock_);
38 destroyed_ = true; 38 destroyed_ = true;
(...skipping 25 matching lines...) Expand all
64 destroyed_ = true; 64 destroyed_ = true;
65 } 65 }
66 } 66 }
67 67
68 bool FakeContextProvider::DestroyedOnMainThread() { 68 bool FakeContextProvider::DestroyedOnMainThread() {
69 base::AutoLock lock(destroyed_lock_); 69 base::AutoLock lock(destroyed_lock_);
70 return destroyed_; 70 return destroyed_;
71 } 71 }
72 72
73 } // namespace cc 73 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698