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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 }; | 51 }; |
52 | 52 |
53 DirectGLImageTransportFactory::DirectGLImageTransportFactory() { | 53 DirectGLImageTransportFactory::DirectGLImageTransportFactory() { |
54 WebKit::WebGraphicsContext3D::Attributes attrs; | 54 WebKit::WebGraphicsContext3D::Attributes attrs; |
55 attrs.shareResources = true; | 55 attrs.shareResources = true; |
56 attrs.noAutomaticFlushes = true; | 56 attrs.noAutomaticFlushes = true; |
57 context_ = webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: | 57 context_ = webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: |
58 CreateViewContext(attrs, NULL); | 58 CreateViewContext(attrs, NULL); |
59 if (context_->makeContextCurrent()) | 59 if (context_->makeContextCurrent()) |
60 context_->pushGroupMarkerEXT( | 60 context_->pushGroupMarkerEXT( |
61 base::StringPrintf("DirectGLImageTransportFactory-%p", this).c_str()); | 61 base::StringPrintf("DirectGLImageTransportFactory-%p", |
| 62 context_.get()).c_str()); |
62 } | 63 } |
63 | 64 |
64 DirectGLImageTransportFactory::~DirectGLImageTransportFactory() { | 65 DirectGLImageTransportFactory::~DirectGLImageTransportFactory() { |
65 } | 66 } |
66 | 67 |
67 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid { | 68 class CmdBufferImageTransportFactory : public ImageTransportFactoryAndroid { |
68 public: | 69 public: |
69 CmdBufferImageTransportFactory(); | 70 CmdBufferImageTransportFactory(); |
70 virtual ~CmdBufferImageTransportFactory(); | 71 virtual ~CmdBufferImageTransportFactory(); |
71 | 72 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, | 110 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, |
110 64 * 1024, // command buffer size | 111 64 * 1024, // command buffer size |
111 std::min(full_screen_texture_size_in_bytes, | 112 std::min(full_screen_texture_size_in_bytes, |
112 kDefaultStartTransferBufferSize), | 113 kDefaultStartTransferBufferSize), |
113 kDefaultMinTransferBufferSize, | 114 kDefaultMinTransferBufferSize, |
114 std::min(3 * full_screen_texture_size_in_bytes, | 115 std::min(3 * full_screen_texture_size_in_bytes, |
115 kDefaultMaxTransferBufferSize)); | 116 kDefaultMaxTransferBufferSize)); |
116 | 117 |
117 if (context_->makeContextCurrent()) | 118 if (context_->makeContextCurrent()) |
118 context_->pushGroupMarkerEXT( | 119 context_->pushGroupMarkerEXT( |
119 base::StringPrintf("CmdBufferImageTransportFactory-%p", this).c_str()); | 120 base::StringPrintf("CmdBufferImageTransportFactory-%p", |
| 121 context_.get()).c_str()); |
120 } | 122 } |
121 | 123 |
122 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { | 124 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { |
123 } | 125 } |
124 | 126 |
125 uint32_t CmdBufferImageTransportFactory::InsertSyncPoint() { | 127 uint32_t CmdBufferImageTransportFactory::InsertSyncPoint() { |
126 if (!context_->makeContextCurrent()) { | 128 if (!context_->makeContextCurrent()) { |
127 LOG(ERROR) << "Failed to make helper context current."; | 129 LOG(ERROR) << "Failed to make helper context current."; |
128 return 0; | 130 return 0; |
129 } | 131 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return g_factory; | 188 return g_factory; |
187 } | 189 } |
188 | 190 |
189 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() { | 191 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() { |
190 } | 192 } |
191 | 193 |
192 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() { | 194 ImageTransportFactoryAndroid::~ImageTransportFactoryAndroid() { |
193 } | 195 } |
194 | 196 |
195 } // namespace content | 197 } // namespace content |
OLD | NEW |