| 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 "gpu/command_buffer/client/gles2_implementation.h" |
| 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 15 #include "third_party/khronos/GLES2/gl2.h" | 15 #include "third_party/khronos/GLES2/gl2.h" |
| 16 #include "ui/gfx/android/device_display_info.h" | 16 #include "ui/gfx/android/device_display_info.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 base::LazyInstance<ObserverList<ImageTransportFactoryAndroidObserver> >::Leaky | 20 base::LazyInstance<ObserverList<ImageTransportFactoryAndroidObserver> >::Leaky |
| 21 g_factory_observers = LAZY_INSTANCE_INITIALIZER; | 21 g_factory_observers = LAZY_INSTANCE_INITIALIZER; |
| 22 | 22 |
| 23 class GLContextLostListener | 23 class GLContextLostListener |
| 24 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 24 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| 25 public: | 25 public: |
| 26 // WebGraphicsContextLostCallback implementation. | 26 // WebGraphicsContextLostCallback implementation. |
| 27 virtual void onContextLost() OVERRIDE; | 27 virtual void onContextLost() override; |
| 28 private: | 28 private: |
| 29 static void DidLoseContext(); | 29 static void DidLoseContext(); |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 static ImageTransportFactoryAndroid* g_factory = NULL; | 34 static ImageTransportFactoryAndroid* g_factory = NULL; |
| 35 | 35 |
| 36 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid { | 36 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid { |
| 37 public: | 37 public: |
| 38 CmdBufferImageTransportFactory(); | 38 CmdBufferImageTransportFactory(); |
| 39 virtual ~CmdBufferImageTransportFactory(); | 39 virtual ~CmdBufferImageTransportFactory(); |
| 40 | 40 |
| 41 virtual GLHelper* GetGLHelper() OVERRIDE; | 41 virtual GLHelper* GetGLHelper() override; |
| 42 virtual uint32 GetChannelID() OVERRIDE { | 42 virtual uint32 GetChannelID() override { |
| 43 return BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); | 43 return BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context_; | 47 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context_; |
| 48 scoped_ptr<GLHelper> gl_helper_; | 48 scoped_ptr<GLHelper> gl_helper_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(CmdBufferImageTransportFactory); | 50 DISALLOW_COPY_AND_ASSIGN(CmdBufferImageTransportFactory); |
| 51 }; | 51 }; |
| 52 | 52 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 void GLContextLostListener::DidLoseContext() { | 152 void GLContextLostListener::DidLoseContext() { |
| 153 delete g_factory; | 153 delete g_factory; |
| 154 g_factory = NULL; | 154 g_factory = NULL; |
| 155 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, | 155 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, |
| 156 g_factory_observers.Get(), | 156 g_factory_observers.Get(), |
| 157 OnLostResources()); | 157 OnLostResources()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace content | 160 } // namespace content |
| OLD | NEW |