| 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 #include "cc/test/fake_context_provider.h" | 5 #include "cc/test/fake_context_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/test/test_web_graphics_context_3d.h" | 8 #include "cc/test/test_web_graphics_context_3d.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 bool FakeContextProvider::BindToCurrentThread() { | 71 bool FakeContextProvider::BindToCurrentThread() { |
| 72 bound_ = true; | 72 bound_ = true; |
| 73 if (!context3d_->makeContextCurrent()) { | 73 if (!context3d_->makeContextCurrent()) { |
| 74 base::AutoLock lock(destroyed_lock_); | 74 base::AutoLock lock(destroyed_lock_); |
| 75 destroyed_ = true; | 75 destroyed_ = true; |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| 80 | 80 |
| 81 WebKit::WebGraphicsContext3D* FakeContextProvider::Context3d() { | 81 blink::WebGraphicsContext3D* FakeContextProvider::Context3d() { |
| 82 DCHECK(context3d_); | 82 DCHECK(context3d_); |
| 83 DCHECK(bound_); | 83 DCHECK(bound_); |
| 84 | 84 |
| 85 return context3d_.get(); | 85 return context3d_.get(); |
| 86 } | 86 } |
| 87 class GrContext* FakeContextProvider::GrContext() { | 87 class GrContext* FakeContextProvider::GrContext() { |
| 88 DCHECK(context3d_); | 88 DCHECK(context3d_); |
| 89 DCHECK(bound_); | 89 DCHECK(bound_); |
| 90 | 90 |
| 91 // TODO(danakj): Make a fake GrContext. | 91 // TODO(danakj): Make a fake GrContext. |
| 92 return NULL; | 92 return NULL; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void FakeContextProvider::VerifyContexts() { | 95 void FakeContextProvider::VerifyContexts() { |
| 96 DCHECK(context3d_); | 96 DCHECK(context3d_); |
| 97 DCHECK(bound_); | 97 DCHECK(bound_); |
| 98 | 98 |
| 99 if (context3d_->isContextLost()) { | 99 if (context3d_->isContextLost()) { |
| 100 base::AutoLock lock(destroyed_lock_); | 100 base::AutoLock lock(destroyed_lock_); |
| 101 destroyed_ = true; | 101 destroyed_ = true; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool FakeContextProvider::DestroyedOnMainThread() { | 105 bool FakeContextProvider::DestroyedOnMainThread() { |
| 106 base::AutoLock lock(destroyed_lock_); | 106 base::AutoLock lock(destroyed_lock_); |
| 107 return destroyed_; | 107 return destroyed_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace cc | 110 } // namespace cc |
| OLD | NEW |