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/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
10 #include "content/common/gpu/client/gl_helper.h" | 10 #include "content/common/gpu/client/gl_helper.h" |
11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 11 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
12 #include "content/common/gpu/gpu_process_launch_causes.h" | 12 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 13 #include "gpu/command_buffer/client/gles2_implementation.h" |
13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
14 #include "third_party/khronos/GLES2/gl2.h" | 15 #include "third_party/khronos/GLES2/gl2.h" |
15 #include "ui/gfx/android/device_display_info.h" | 16 #include "ui/gfx/android/device_display_info.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 base::LazyInstance<ObserverList<ImageTransportFactoryAndroidObserver> >::Leaky | 20 base::LazyInstance<ObserverList<ImageTransportFactoryAndroidObserver> >::Leaky |
20 g_factory_observers = LAZY_INSTANCE_INITIALIZER; | 21 g_factory_observers = LAZY_INSTANCE_INITIALIZER; |
21 | 22 |
22 class GLContextLostListener | 23 class GLContextLostListener |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 LOG(ERROR) << "Failed to make helper context current."; | 138 LOG(ERROR) << "Failed to make helper context current."; |
138 return; | 139 return; |
139 } | 140 } |
140 context_->bindTexture(GL_TEXTURE_2D, texture_id); | 141 context_->bindTexture(GL_TEXTURE_2D, texture_id); |
141 context_->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name); | 142 context_->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox_name); |
142 context_->flush(); | 143 context_->flush(); |
143 } | 144 } |
144 | 145 |
145 GLHelper* CmdBufferImageTransportFactory::GetGLHelper() { | 146 GLHelper* CmdBufferImageTransportFactory::GetGLHelper() { |
146 if (!gl_helper_) | 147 if (!gl_helper_) |
147 gl_helper_.reset(new GLHelper(context_.get(), | 148 gl_helper_.reset(new GLHelper(context_->GetImplementation(), |
148 context_->GetContextSupport())); | 149 context_->GetContextSupport())); |
149 | 150 |
150 return gl_helper_.get(); | 151 return gl_helper_.get(); |
151 } | 152 } |
152 | 153 |
153 } // anonymous namespace | 154 } // anonymous namespace |
154 | 155 |
155 // static | 156 // static |
156 ImageTransportFactoryAndroid* ImageTransportFactoryAndroid::GetInstance() { | 157 ImageTransportFactoryAndroid* ImageTransportFactoryAndroid::GetInstance() { |
157 if (!g_factory) | 158 if (!g_factory) |
(...skipping 28 matching lines...) Expand all Loading... |
186 | 187 |
187 void GLContextLostListener::DidLoseContext() { | 188 void GLContextLostListener::DidLoseContext() { |
188 delete g_factory; | 189 delete g_factory; |
189 g_factory = NULL; | 190 g_factory = NULL; |
190 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, | 191 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, |
191 g_factory_observers.Get(), | 192 g_factory_observers.Get(), |
192 OnLostResources()); | 193 OnLostResources()); |
193 } | 194 } |
194 | 195 |
195 } // namespace content | 196 } // namespace content |
OLD | NEW |