Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 649533003: C++11 declares a type safe null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Presubmit errors Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/gpu/client/context_provider_command_buffer.h" 5 #include "content/common/gpu/client/context_provider_command_buffer.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "cc/output/managed_memory_policy.h" 12 #include "cc/output/managed_memory_policy.h"
13 #include "gpu/command_buffer/client/gles2_implementation.h" 13 #include "gpu/command_buffer/client/gles2_implementation.h"
14 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" 14 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 class ContextProviderCommandBuffer::LostContextCallbackProxy 18 class ContextProviderCommandBuffer::LostContextCallbackProxy
19 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { 19 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
20 public: 20 public:
21 explicit LostContextCallbackProxy(ContextProviderCommandBuffer* provider) 21 explicit LostContextCallbackProxy(ContextProviderCommandBuffer* provider)
22 : provider_(provider) { 22 : provider_(provider) {
23 provider_->context3d_->setContextLostCallback(this); 23 provider_->context3d_->setContextLostCallback(this);
24 } 24 }
25 25
26 virtual ~LostContextCallbackProxy() { 26 virtual ~LostContextCallbackProxy() {
27 provider_->context3d_->setContextLostCallback(NULL); 27 provider_->context3d_->setContextLostCallback(nullptr);
28 } 28 }
29 29
30 virtual void onContextLost() { 30 virtual void onContextLost() {
31 provider_->OnLostContext(); 31 provider_->OnLostContext();
32 } 32 }
33 33
34 private: 34 private:
35 ContextProviderCommandBuffer* provider_; 35 ContextProviderCommandBuffer* provider_;
36 }; 36 };
37 37
38 scoped_refptr<ContextProviderCommandBuffer> 38 scoped_refptr<ContextProviderCommandBuffer>
39 ContextProviderCommandBuffer::Create( 39 ContextProviderCommandBuffer::Create(
40 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, 40 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d,
41 const std::string& debug_name) { 41 const std::string& debug_name) {
42 if (!context3d) 42 if (!context3d)
43 return NULL; 43 return nullptr;
44 44
45 return new ContextProviderCommandBuffer(context3d.Pass(), debug_name); 45 return new ContextProviderCommandBuffer(context3d.Pass(), debug_name);
46 } 46 }
47 47
48 ContextProviderCommandBuffer::ContextProviderCommandBuffer( 48 ContextProviderCommandBuffer::ContextProviderCommandBuffer(
49 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, 49 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d,
50 const std::string& debug_name) 50 const std::string& debug_name)
51 : context3d_(context3d.Pass()), 51 : context3d_(context3d.Pass()),
52 debug_name_(debug_name), 52 debug_name_(debug_name),
53 destroyed_(false) { 53 destroyed_(false) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( 215 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback(
216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { 216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {
217 DCHECK(context_thread_checker_.CalledOnValidThread()); 217 DCHECK(context_thread_checker_.CalledOnValidThread());
218 DCHECK(memory_policy_changed_callback_.is_null() || 218 DCHECK(memory_policy_changed_callback_.is_null() ||
219 memory_policy_changed_callback.is_null()); 219 memory_policy_changed_callback.is_null());
220 memory_policy_changed_callback_ = memory_policy_changed_callback; 220 memory_policy_changed_callback_ = memory_policy_changed_callback;
221 } 221 }
222 222
223 } // namespace content 223 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.cc ('k') | content/common/gpu/client/gl_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698