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/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 limits.max_transfer_buffer_size = std::min( | 183 limits.max_transfer_buffer_size = std::min( |
184 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); | 184 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); |
185 limits.mapped_memory_reclaim_limit = | 185 limits.mapped_memory_reclaim_limit = |
186 WebGraphicsContext3DCommandBufferImpl::kNoLimit; | 186 WebGraphicsContext3DCommandBufferImpl::kNoLimit; |
187 bool lose_context_when_out_of_memory = false; | 187 bool lose_context_when_out_of_memory = false; |
188 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 188 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
189 new WebGraphicsContext3DCommandBufferImpl( | 189 new WebGraphicsContext3DCommandBufferImpl( |
190 0, // offscreen | 190 0, // offscreen |
191 url, gpu_channel_host.get(), attrs, lose_context_when_out_of_memory, | 191 url, gpu_channel_host.get(), attrs, lose_context_when_out_of_memory, |
192 limits, nullptr)); | 192 limits, nullptr)); |
193 if (context->InitializeOnCurrentThread()) | 193 if (context->InitializeOnCurrentThread()) { |
194 context->pushGroupMarkerEXT( | 194 context->pushGroupMarkerEXT( |
195 base::StringPrintf("CmdBufferImageTransportFactory-%p", | 195 base::StringPrintf("CmdBufferImageTransportFactory-%p", |
196 context.get()).c_str()); | 196 context.get()).c_str()); |
| 197 } else { |
| 198 context.reset(); |
| 199 } |
| 200 |
197 return context.Pass(); | 201 return context.Pass(); |
198 } | 202 } |
199 | 203 |
200 // This can only be used for readback postprocessing. It may return null if the | 204 // This can only be used for readback postprocessing. It may return null if the |
201 // channel was lost and not reestablished yet. | 205 // channel was lost and not reestablished yet. |
202 GLHelper* GetPostReadbackGLHelper() { | 206 GLHelper* GetPostReadbackGLHelper() { |
203 static GLHelperHolder* g_readback_helper_holder = nullptr; | 207 static GLHelperHolder* g_readback_helper_holder = nullptr; |
204 | 208 |
205 if (g_readback_helper_holder && g_readback_helper_holder->IsLost()) { | 209 if (g_readback_helper_holder && g_readback_helper_holder->IsLost()) { |
206 delete g_readback_helper_holder; | 210 delete g_readback_helper_holder; |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 results->orientationAngle = display.RotationAsDegree(); | 1891 results->orientationAngle = display.RotationAsDegree(); |
1888 results->orientationType = | 1892 results->orientationType = |
1889 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1893 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1890 gfx::DeviceDisplayInfo info; | 1894 gfx::DeviceDisplayInfo info; |
1891 results->depth = info.GetBitsPerPixel(); | 1895 results->depth = info.GetBitsPerPixel(); |
1892 results->depthPerComponent = info.GetBitsPerComponent(); | 1896 results->depthPerComponent = info.GetBitsPerComponent(); |
1893 results->isMonochrome = (results->depthPerComponent == 0); | 1897 results->isMonochrome = (results->depthPerComponent == 0); |
1894 } | 1898 } |
1895 | 1899 |
1896 } // namespace content | 1900 } // namespace content |
OLD | NEW |