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

Side by Side Diff: mojo/public/cpp/application/lazy_interface_ptr.h

Issue 612243002: Mojo: NULL -> nullptr in mojo/public/cpp outside of bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | mojo/public/cpp/application/lib/application_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_ 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
6 #define MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_ 6 #define MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
7 7
8 #include <string>
9
10 #include "mojo/public/cpp/application/connect.h" 8 #include "mojo/public/cpp/application/connect.h"
11 #include "mojo/public/interfaces/application/service_provider.mojom.h" 9 #include "mojo/public/interfaces/application/service_provider.mojom.h"
12 10
13 namespace mojo { 11 namespace mojo {
14 12
15 template<typename Interface> 13 template<typename Interface>
16 class LazyInterfacePtr : public InterfacePtr<Interface> { 14 class LazyInterfacePtr : public InterfacePtr<Interface> {
17 public: 15 public:
18 LazyInterfacePtr() : service_provider_(NULL) {} 16 LazyInterfacePtr() : service_provider_(nullptr) {}
19 17
20 LazyInterfacePtr(ServiceProvider* service_provider) 18 LazyInterfacePtr(ServiceProvider* service_provider)
21 : service_provider_(service_provider) { 19 : service_provider_(service_provider) {
22 } 20 }
23 21
24 void set_service_provider(ServiceProvider* service_provider) { 22 void set_service_provider(ServiceProvider* service_provider) {
25 if (service_provider != service_provider_) { 23 if (service_provider != service_provider_) {
26 InterfacePtr<Interface>::reset(); 24 InterfacePtr<Interface>::reset();
27 } 25 }
28 service_provider_ = service_provider; 26 service_provider_ = service_provider;
(...skipping 10 matching lines...) Expand all
39 Interface* operator->() const { return get(); } 37 Interface* operator->() const { return get(); }
40 Interface& operator*() const { return *get(); } 38 Interface& operator*() const { return *get(); }
41 39
42 private: 40 private:
43 ServiceProvider* service_provider_; 41 ServiceProvider* service_provider_;
44 }; 42 };
45 43
46 } // namespace mojo 44 } // namespace mojo
47 45
48 #endif // MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_ 46 #endif // MOJO_PUBLIC_CPP_APPLICATION_LAZY_INTERFACE_PTR_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/application/lib/application_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698