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 bool bind_generates_resource = false; | |
86 bool lose_context_when_out_of_memory = false; | |
87 context_.reset( | 85 context_.reset( |
88 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen | 86 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen |
89 url, | 87 url, |
90 gpu_channel_host.get(), | 88 gpu_channel_host.get(), |
91 attrs, | 89 attrs, |
92 bind_generates_resource, | 90 false, |
93 lose_context_when_out_of_memory, | |
94 limits, | 91 limits, |
95 NULL)); | 92 NULL)); |
96 context_->setContextLostCallback(context_lost_listener_.get()); | 93 context_->setContextLostCallback(context_lost_listener_.get()); |
97 if (context_->makeContextCurrent()) | 94 if (context_->makeContextCurrent()) |
98 context_->pushGroupMarkerEXT( | 95 context_->pushGroupMarkerEXT( |
99 base::StringPrintf("CmdBufferImageTransportFactory-%p", | 96 base::StringPrintf("CmdBufferImageTransportFactory-%p", |
100 context_.get()).c_str()); | 97 context_.get()).c_str()); |
101 } | 98 } |
102 | 99 |
103 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { | 100 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 188 |
192 void GLContextLostListener::DidLoseContext() { | 189 void GLContextLostListener::DidLoseContext() { |
193 delete g_factory; | 190 delete g_factory; |
194 g_factory = NULL; | 191 g_factory = NULL; |
195 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, | 192 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, |
196 g_factory_observers.Get(), | 193 g_factory_observers.Get(), |
197 OnLostResources()); | 194 OnLostResources()); |
198 } | 195 } |
199 | 196 |
200 } // namespace content | 197 } // namespace content |
OLD | NEW |