| 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 "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/browser/renderer_host/compositor_impl_android.h" | 10 #include "content/browser/renderer_host/compositor_impl_android.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 DirectGLImageTransportFactory::DirectGLImageTransportFactory() { | 54 DirectGLImageTransportFactory::DirectGLImageTransportFactory() { |
| 55 WebKit::WebGraphicsContext3D::Attributes attrs; | 55 WebKit::WebGraphicsContext3D::Attributes attrs; |
| 56 attrs.shareResources = true; | 56 attrs.shareResources = true; |
| 57 attrs.noAutomaticFlushes = true; | 57 attrs.noAutomaticFlushes = true; |
| 58 context_.reset(webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: | 58 context_.reset(webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 59 CreateViewContext(attrs, NULL)); | 59 CreateViewContext(attrs, NULL)); |
| 60 if (context_->makeContextCurrent()) | 60 if (context_->makeContextCurrent()) |
| 61 context_->pushGroupMarkerEXT( | 61 context_->pushGroupMarkerEXT( |
| 62 base::StringPrintf("DirectGLImageTransportFactory-%p", this).c_str()); | 62 base::StringPrintf("DirectGLImageTransportFactory-%p", |
| 63 context_.get()).c_str()); |
| 63 } | 64 } |
| 64 | 65 |
| 65 DirectGLImageTransportFactory::~DirectGLImageTransportFactory() { | 66 DirectGLImageTransportFactory::~DirectGLImageTransportFactory() { |
| 66 } | 67 } |
| 67 | 68 |
| 68 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid { | 69 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid { |
| 69 public: | 70 public: |
| 70 CmdBufferImageTransportFactory(); | 71 CmdBufferImageTransportFactory(); |
| 71 virtual ~CmdBufferImageTransportFactory(); | 72 virtual ~CmdBufferImageTransportFactory(); |
| 72 | 73 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 100 url, | 101 url, |
| 101 factory, | 102 factory, |
| 102 swap_client)); | 103 swap_client)); |
| 103 context_->InitializeWithDefaultBufferSizes( | 104 context_->InitializeWithDefaultBufferSizes( |
| 104 attrs, | 105 attrs, |
| 105 false, | 106 false, |
| 106 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); | 107 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); |
| 107 | 108 |
| 108 if (context_->makeContextCurrent()) | 109 if (context_->makeContextCurrent()) |
| 109 context_->pushGroupMarkerEXT( | 110 context_->pushGroupMarkerEXT( |
| 110 base::StringPrintf("CmdBufferImageTransportFactory-%p", this).c_str()); | 111 base::StringPrintf("CmdBufferImageTransportFactory-%p", |
| 112 context_.get()).c_str()); |
| 111 } | 113 } |
| 112 | 114 |
| 113 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { | 115 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { |
| 114 } | 116 } |
| 115 | 117 |
| 116 uint32_t CmdBufferImageTransportFactory::InsertSyncPoint() { | 118 uint32_t CmdBufferImageTransportFactory::InsertSyncPoint() { |
| 117 if (!context_->makeContextCurrent()) { | 119 if (!context_->makeContextCurrent()) { |
| 118 LOG(ERROR) << "Failed to make helper context current."; | 120 LOG(ERROR) << "Failed to make helper context current."; |
| 119 return 0; | 121 return 0; |
| 120 } | 122 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return g_factory; | 189 return g_factory; |
| 188 } | 190 } |
| 189 | 191 |
| 190 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() { | 192 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() { |
| 191 } | 193 } |
| 192 | 194 |
| 193 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() { | 195 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() { |
| 194 } | 196 } |
| 195 | 197 |
| 196 } // namespace content | 198 } // namespace content |
| OLD | NEW |