OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 : factory_(factory), | 121 : factory_(factory), |
122 destroyed_(false) {} | 122 destroyed_(false) {} |
123 | 123 |
124 virtual bool InitializeOnMainThread() OVERRIDE { | 124 virtual bool InitializeOnMainThread() OVERRIDE { |
125 if (context3d_) | 125 if (context3d_) |
126 return true; | 126 return true; |
127 context3d_.reset(factory_->CreateOffscreenContext()); | 127 context3d_.reset(factory_->CreateOffscreenContext()); |
128 return !!context3d_; | 128 return !!context3d_; |
129 } | 129 } |
130 | 130 |
131 virtual bool BindToCurrentThread() { | 131 virtual bool BindToCurrentThread() OVERRIDE { |
132 return context3d_->makeContextCurrent(); | 132 return context3d_->makeContextCurrent(); |
133 } | 133 } |
134 | 134 |
135 virtual WebKit::WebGraphicsContext3D* Context3d() { return context3d_.get(); } | 135 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE { |
| 136 return context3d_.get(); |
| 137 } |
136 | 138 |
137 virtual class GrContext* GrContext() { | 139 virtual class GrContext* GrContext() OVERRIDE { |
138 if (!gr_context_) { | 140 if (!gr_context_) { |
139 gr_context_.reset( | 141 gr_context_.reset( |
140 new webkit::gpu::GrContextForWebGraphicsContext3D(context3d_.get())); | 142 new webkit::gpu::GrContextForWebGraphicsContext3D(context3d_.get())); |
141 } | 143 } |
142 return gr_context_->get(); | 144 return gr_context_->get(); |
143 } | 145 } |
144 | 146 |
145 virtual void VerifyContexts() OVERRIDE { | 147 virtual void VerifyContexts() OVERRIDE { |
146 if (context3d_ && !context3d_->isContextLost()) | 148 if (context3d_ && !context3d_->isContextLost()) |
147 return; | 149 return; |
148 base::AutoLock lock(destroyed_lock_); | 150 base::AutoLock lock(destroyed_lock_); |
149 destroyed_ = true; | 151 destroyed_ = true; |
150 } | 152 } |
151 | 153 |
152 bool DestroyedOnMainThread() { | 154 virtual bool DestroyedOnMainThread() OVERRIDE { |
153 base::AutoLock lock(destroyed_lock_); | 155 base::AutoLock lock(destroyed_lock_); |
154 return destroyed_; | 156 return destroyed_; |
155 } | 157 } |
156 | 158 |
157 protected: | 159 protected: |
158 virtual ~ContextProviderFromContextFactory() {} | 160 virtual ~ContextProviderFromContextFactory() {} |
159 | 161 |
160 private: | 162 private: |
161 ContextFactory* factory_; | 163 ContextFactory* factory_; |
162 base::Lock destroyed_lock_; | 164 base::Lock destroyed_lock_; |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 COMPOSITOR_EXPORT void DisableTestCompositor() { | 695 COMPOSITOR_EXPORT void DisableTestCompositor() { |
694 ResetImplicitFactory(); | 696 ResetImplicitFactory(); |
695 g_test_compositor_enabled = false; | 697 g_test_compositor_enabled = false; |
696 } | 698 } |
697 | 699 |
698 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 700 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
699 return g_test_compositor_enabled; | 701 return g_test_compositor_enabled; |
700 } | 702 } |
701 | 703 |
702 } // namespace ui | 704 } // namespace ui |
OLD | NEW |