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 "content/browser/renderer_host/image_transport_factory_android.h" | 5 #include "content/browser/renderer_host/image_transport_factory_android.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
9 #include "content/browser/renderer_host/compositor_impl_android.h" | 9 #include "content/browser/renderer_host/compositor_impl_android.h" |
10 #include "content/common/gpu/gpu_process_launch_causes.h" | 10 #include "content/common/gpu/gpu_process_launch_causes.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 uint32 texture_id, const signed char* mailbox_name) { | 153 uint32 texture_id, const signed char* mailbox_name) { |
154 if (!context_->makeContextCurrent()) { | 154 if (!context_->makeContextCurrent()) { |
155 LOG(ERROR) << "Failed to make helper context current."; | 155 LOG(ERROR) << "Failed to make helper context current."; |
156 return; | 156 return; |
157 } | 157 } |
158 context_->bindTexture(GL_TEXTURE_2D, texture_id); | 158 context_->bindTexture(GL_TEXTURE_2D, texture_id); |
159 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name); | 159 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name); |
160 } | 160 } |
161 | 161 |
162 GLHelper* CmdBufferImageTransportFactory::GetGLHelper() { | 162 GLHelper* CmdBufferImageTransportFactory::GetGLHelper() { |
163 if (!gl_helper_.get()) | 163 if (!gl_helper_) |
164 gl_helper_.reset(new GLHelper(context_.get())); | 164 gl_helper_.reset(new GLHelper(context_.get())); |
165 | 165 |
166 return gl_helper_.get(); | 166 return gl_helper_.get(); |
167 } | 167 } |
168 | 168 |
169 } // anonymous namespace | 169 } // anonymous namespace |
170 | 170 |
171 // static | 171 // static |
172 ImageTransportFactoryAndroid* ImageTransportFactoryAndroid::GetInstance() { | 172 ImageTransportFactoryAndroid* ImageTransportFactoryAndroid::GetInstance() { |
173 if (!g_factory) { | 173 if (!g_factory) { |
174 if (CompositorImpl::UsesDirectGL()) | 174 if (CompositorImpl::UsesDirectGL()) |
175 g_factory = new DirectGLImageTransportFactory(); | 175 g_factory = new DirectGLImageTransportFactory(); |
176 else | 176 else |
177 g_factory = new CmdBufferImageTransportFactory(); | 177 g_factory = new CmdBufferImageTransportFactory(); |
178 } | 178 } |
179 | 179 |
180 return g_factory; | 180 return g_factory; |
181 } | 181 } |
182 | 182 |
183 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() { | 183 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() { |
184 } | 184 } |
185 | 185 |
186 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() { | 186 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() { |
187 } | 187 } |
188 | 188 |
189 } // namespace content | 189 } // namespace content |
OLD | NEW |