OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/android/in_process/context_provider_in_process.h" | 5 #include "content/browser/android/in_process/context_provider_in_process.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "cc/output/managed_memory_policy.h" | 10 #include "cc/output/managed_memory_policy.h" |
11 #include "content/common/gpu/client/grcontext_for_webgraphicscontext3d.h" | 11 #include "content/common/gpu/client/grcontext_for_webgraphicscontext3d.h" |
12 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 12 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
13 #include "gpu/command_buffer/client/gles2_implementation.h" | 13 #include "gpu/command_buffer/client/gles2_implementation.h" |
14 #include "third_party/skia/include/gpu/GrContext.h" | 14 #include "third_party/skia/include/gpu/GrContext.h" |
15 | 15 |
16 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl; | 16 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class ContextProviderInProcess::LostContextCallbackProxy | 20 class ContextProviderInProcess::LostContextCallbackProxy |
21 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 21 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
22 public: | 22 public: |
23 explicit LostContextCallbackProxy(ContextProviderInProcess* provider) | 23 explicit LostContextCallbackProxy(ContextProviderInProcess* provider) |
24 : provider_(provider) { | 24 : provider_(provider) { |
25 provider_->WebContext3DImpl()->setContextLostCallback(this); | 25 provider_->WebContext3DImpl()->setContextLostCallback(this); |
26 } | 26 } |
27 | 27 |
28 virtual ~LostContextCallbackProxy() { | 28 ~LostContextCallbackProxy() override { |
29 provider_->WebContext3DImpl()->setContextLostCallback(NULL); | 29 provider_->WebContext3DImpl()->setContextLostCallback(NULL); |
30 } | 30 } |
31 | 31 |
32 virtual void onContextLost() { | 32 void onContextLost() override { |
33 provider_->OnLostContext(); | 33 provider_->OnLostContext(); |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
37 ContextProviderInProcess* provider_; | 37 ContextProviderInProcess* provider_; |
38 }; | 38 }; |
39 | 39 |
40 // static | 40 // static |
41 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( | 41 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( |
42 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, | 42 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 void ContextProviderInProcess::SetLostContextCallback( | 188 void ContextProviderInProcess::SetLostContextCallback( |
189 const LostContextCallback& lost_context_callback) { | 189 const LostContextCallback& lost_context_callback) { |
190 DCHECK(context_thread_checker_.CalledOnValidThread()); | 190 DCHECK(context_thread_checker_.CalledOnValidThread()); |
191 DCHECK(lost_context_callback_.is_null() || | 191 DCHECK(lost_context_callback_.is_null() || |
192 lost_context_callback.is_null()); | 192 lost_context_callback.is_null()); |
193 lost_context_callback_ = lost_context_callback; | 193 lost_context_callback_ = lost_context_callback; |
194 } | 194 } |
195 | 195 |
196 } // namespace content | 196 } // namespace content |
OLD | NEW |