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" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 display_info.GetDisplayWidth() * | 75 display_info.GetDisplayWidth() * |
76 kBytesPerPixel; | 76 kBytesPerPixel; |
77 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 77 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
78 limits.command_buffer_size = 64 * 1024; | 78 limits.command_buffer_size = 64 * 1024; |
79 limits.start_transfer_buffer_size = 64 * 1024; | 79 limits.start_transfer_buffer_size = 64 * 1024; |
80 limits.min_transfer_buffer_size = 64 * 1024; | 80 limits.min_transfer_buffer_size = 64 * 1024; |
81 limits.max_transfer_buffer_size = std::min( | 81 limits.max_transfer_buffer_size = std::min( |
82 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); | 82 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); |
83 limits.mapped_memory_reclaim_limit = | 83 limits.mapped_memory_reclaim_limit = |
84 WebGraphicsContext3DCommandBufferImpl::kNoLimit; | 84 WebGraphicsContext3DCommandBufferImpl::kNoLimit; |
| 85 #if !defined(OS_CHROMEOS) |
85 bool bind_generates_resource = false; | 86 bool bind_generates_resource = false; |
| 87 #endif |
86 bool lose_context_when_out_of_memory = false; | 88 bool lose_context_when_out_of_memory = false; |
87 context_.reset( | 89 context_.reset( |
88 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen | 90 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen |
89 url, | 91 url, |
90 gpu_channel_host.get(), | 92 gpu_channel_host.get(), |
91 attrs, | 93 attrs, |
| 94 #if !defined(OS_CHROMEOS) |
92 bind_generates_resource, | 95 bind_generates_resource, |
| 96 #endif |
93 lose_context_when_out_of_memory, | 97 lose_context_when_out_of_memory, |
94 limits, | 98 limits, |
95 NULL)); | 99 NULL)); |
96 context_->setContextLostCallback(context_lost_listener_.get()); | 100 context_->setContextLostCallback(context_lost_listener_.get()); |
97 if (context_->makeContextCurrent()) | 101 if (context_->makeContextCurrent()) |
98 context_->pushGroupMarkerEXT( | 102 context_->pushGroupMarkerEXT( |
99 base::StringPrintf("CmdBufferImageTransportFactory-%p", | 103 base::StringPrintf("CmdBufferImageTransportFactory-%p", |
100 context_.get()).c_str()); | 104 context_.get()).c_str()); |
101 } | 105 } |
102 | 106 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 195 |
192 void GLContextLostListener::DidLoseContext() { | 196 void GLContextLostListener::DidLoseContext() { |
193 delete g_factory; | 197 delete g_factory; |
194 g_factory = NULL; | 198 g_factory = NULL; |
195 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, | 199 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, |
196 g_factory_observers.Get(), | 200 g_factory_observers.Get(), |
197 OnLostResources()); | 201 OnLostResources()); |
198 } | 202 } |
199 | 203 |
200 } // namespace content | 204 } // namespace content |
OLD | NEW |