Chromium Code Reviews| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 if (!gl_helper_) | 97 if (!gl_helper_) |
| 98 gl_helper_.reset(new GLHelper(context_->GetImplementation(), | 98 gl_helper_.reset(new GLHelper(context_->GetImplementation(), |
| 99 context_->GetContextSupport())); | 99 context_->GetContextSupport())); |
| 100 | 100 |
| 101 return gl_helper_.get(); | 101 return gl_helper_.get(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // anonymous namespace | 104 } // anonymous namespace |
| 105 | 105 |
| 106 // static | 106 // static |
| 107 void ImageTransportFactoryAndroid::InitializeForUnitTests( | |
|
no sievers
2014/07/10 18:52:29
Do we need a method for teardown also?
With unit
dshwang
2014/07/10 19:23:11
Ah, you're right. I mimic this method after ImageT
| |
| 108 ImageTransportFactoryAndroid* test_factory) { | |
| 109 DCHECK(!g_factory); | |
| 110 g_factory = test_factory; | |
| 111 } | |
| 112 | |
| 113 // static | |
| 107 ImageTransportFactoryAndroid* ImageTransportFactoryAndroid::GetInstance() { | 114 ImageTransportFactoryAndroid* ImageTransportFactoryAndroid::GetInstance() { |
| 108 if (!g_factory) | 115 if (!g_factory) |
| 109 g_factory = new CmdBufferImageTransportFactory(); | 116 g_factory = new CmdBufferImageTransportFactory(); |
| 110 | 117 |
| 111 return g_factory; | 118 return g_factory; |
| 112 } | 119 } |
| 113 | 120 |
| 114 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() | 121 ImageTransportFactoryAndroid::ImageTransportFactoryAndroid() |
| 115 : context_lost_listener_(new GLContextLostListener()) {} | 122 : context_lost_listener_(new GLContextLostListener()) {} |
| 116 | 123 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 137 | 144 |
| 138 void GLContextLostListener::DidLoseContext() { | 145 void GLContextLostListener::DidLoseContext() { |
| 139 delete g_factory; | 146 delete g_factory; |
| 140 g_factory = NULL; | 147 g_factory = NULL; |
| 141 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, | 148 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, |
| 142 g_factory_observers.Get(), | 149 g_factory_observers.Get(), |
| 143 OnLostResources()); | 150 OnLostResources()); |
| 144 } | 151 } |
| 145 | 152 |
| 146 } // namespace content | 153 } // namespace content |
| OLD | NEW |