Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: content/browser/renderer_host/image_transport_factory_android.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
14 #include "third_party/khronos/GLES2/gl2.h" 14 #include "third_party/khronos/GLES2/gl2.h"
15 #include "ui/gfx/android/device_display_info.h" 15 #include "ui/gfx/android/device_display_info.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 base::LazyInstance<ObserverList<ImageTransportFactoryAndroidObserver> >::Leaky 19 base::LazyInstance<ObserverList<ImageTransportFactoryAndroidObserver> >::Leaky
20 g_factory_observers = LAZY_INSTANCE_INITIALIZER; 20 g_factory_observers = LAZY_INSTANCE_INITIALIZER;
21 21
22 class GLContextLostListener 22 class GLContextLostListener
23 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { 23 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
24 public: 24 public:
25 // WebGraphicsContextLostCallback implementation. 25 // WebGraphicsContextLostCallback implementation.
26 virtual void onContextLost() OVERRIDE; 26 virtual void onContextLost() OVERRIDE;
27 private: 27 private:
28 static void DidLoseContext(); 28 static void DidLoseContext();
29 }; 29 };
30 30
31 namespace { 31 namespace {
32 32
33 static ImageTransportFactoryAndroid* g_factory = NULL; 33 static ImageTransportFactoryAndroid* g_factory = NULL;
34 34
35 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid { 35 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid {
36 public: 36 public:
37 CmdBufferImageTransportFactory(); 37 CmdBufferImageTransportFactory();
38 virtual ~CmdBufferImageTransportFactory(); 38 virtual ~CmdBufferImageTransportFactory();
39 39
40 virtual uint32_t InsertSyncPoint() OVERRIDE; 40 virtual uint32_t InsertSyncPoint() OVERRIDE;
41 virtual void WaitSyncPoint(uint32_t sync_point) OVERRIDE; 41 virtual void WaitSyncPoint(uint32_t sync_point) OVERRIDE;
42 virtual uint32_t CreateTexture() OVERRIDE; 42 virtual uint32_t CreateTexture() OVERRIDE;
43 virtual void DeleteTexture(uint32_t id) OVERRIDE; 43 virtual void DeleteTexture(uint32_t id) OVERRIDE;
44 virtual void AcquireTexture( 44 virtual void AcquireTexture(
45 uint32 texture_id, const signed char* mailbox_name) OVERRIDE; 45 uint32 texture_id, const signed char* mailbox_name) OVERRIDE;
46 virtual WebKit::WebGraphicsContext3D* GetContext3D() OVERRIDE { 46 virtual blink::WebGraphicsContext3D* GetContext3D() OVERRIDE {
47 return context_.get(); 47 return context_.get();
48 } 48 }
49 virtual GLHelper* GetGLHelper() OVERRIDE; 49 virtual GLHelper* GetGLHelper() OVERRIDE;
50 50
51 private: 51 private:
52 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context_; 52 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context_;
53 scoped_ptr<GLHelper> gl_helper_; 53 scoped_ptr<GLHelper> gl_helper_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(CmdBufferImageTransportFactory); 55 DISALLOW_COPY_AND_ASSIGN(CmdBufferImageTransportFactory);
56 }; 56 };
57 57
58 CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() { 58 CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() {
59 BrowserGpuChannelHostFactory* factory = 59 BrowserGpuChannelHostFactory* factory =
60 BrowserGpuChannelHostFactory::instance(); 60 BrowserGpuChannelHostFactory::instance();
61 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->EstablishGpuChannelSyn c( 61 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->EstablishGpuChannelSyn c(
62 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); 62 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE));
63 DCHECK(gpu_channel_host); 63 DCHECK(gpu_channel_host);
64 64
65 WebKit::WebGraphicsContext3D::Attributes attrs; 65 blink::WebGraphicsContext3D::Attributes attrs;
66 attrs.shareResources = true; 66 attrs.shareResources = true;
67 GURL url("chrome://gpu/ImageTransportFactoryAndroid"); 67 GURL url("chrome://gpu/ImageTransportFactoryAndroid");
68 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client; 68 base::WeakPtr<WebGraphicsContext3DSwapBuffersClient> swap_client;
69 static const size_t kBytesPerPixel = 4; 69 static const size_t kBytesPerPixel = 4;
70 gfx::DeviceDisplayInfo display_info; 70 gfx::DeviceDisplayInfo display_info;
71 size_t full_screen_texture_size_in_bytes = display_info.GetDisplayHeight() * 71 size_t full_screen_texture_size_in_bytes = display_info.GetDisplayHeight() *
72 display_info.GetDisplayWidth() * 72 display_info.GetDisplayWidth() *
73 kBytesPerPixel; 73 kBytesPerPixel;
74 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 74 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
75 limits.command_buffer_size = 64 * 1024; 75 limits.command_buffer_size = 64 * 1024;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 void GLContextLostListener::DidLoseContext() { 186 void GLContextLostListener::DidLoseContext() {
187 delete g_factory; 187 delete g_factory;
188 g_factory = NULL; 188 g_factory = NULL;
189 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, 189 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver,
190 g_factory_observers.Get(), 190 g_factory_observers.Get(),
191 OnLostResources()); 191 OnLostResources());
192 } 192 }
193 193
194 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/image_transport_factory_android.h ('k') | content/browser/renderer_host/ime_adapter_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698