| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 bool lose_context_when_out_of_memory = false; | 76 bool lose_context_when_out_of_memory = false; |
| 77 context_.reset( | 77 context_.reset( |
| 78 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen | 78 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen |
| 79 url, | 79 url, |
| 80 gpu_channel_host.get(), | 80 gpu_channel_host.get(), |
| 81 attrs, | 81 attrs, |
| 82 lose_context_when_out_of_memory, | 82 lose_context_when_out_of_memory, |
| 83 limits, | 83 limits, |
| 84 NULL)); | 84 NULL)); |
| 85 context_->setContextLostCallback(context_lost_listener_.get()); | 85 context_->setContextLostCallback(context_lost_listener_.get()); |
| 86 if (context_->makeContextCurrent()) | 86 if (context_->InitializeOnCurrentThread()) |
| 87 context_->pushGroupMarkerEXT( | 87 context_->pushGroupMarkerEXT( |
| 88 base::StringPrintf("CmdBufferImageTransportFactory-%p", | 88 base::StringPrintf("CmdBufferImageTransportFactory-%p", |
| 89 context_.get()).c_str()); | 89 context_.get()).c_str()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { | 92 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { |
| 93 context_->setContextLostCallback(NULL); | 93 context_->setContextLostCallback(NULL); |
| 94 } | 94 } |
| 95 | 95 |
| 96 GLHelper* CmdBufferImageTransportFactory::GetGLHelper() { | 96 GLHelper* CmdBufferImageTransportFactory::GetGLHelper() { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 void GLContextLostListener::DidLoseContext() { | 152 void GLContextLostListener::DidLoseContext() { |
| 153 delete g_factory; | 153 delete g_factory; |
| 154 g_factory = NULL; | 154 g_factory = NULL; |
| 155 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, | 155 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, |
| 156 g_factory_observers.Get(), | 156 g_factory_observers.Get(), |
| 157 OnLostResources()); | 157 OnLostResources()); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace content | 160 } // namespace content |
| OLD | NEW |