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

Side by Side Diff: native_client_sdk/src/libraries/sdk_util/scoped_ref.h

Issue 19271009: [NaCl SDK} Add EventListener and EventEmitter to support epoll. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove extra mutex Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* Copyright 2013 The Chromium Authors. All rights reserved. 1 /* Copyright 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 */
Sam Clegg 2013/07/17 17:34:56 C++ comment
5 5
6 #ifndef LIBRARIES_SDK_UTIL_SCOPED_REF_H_ 6 #ifndef LIBRARIES_SDK_UTIL_SCOPED_REF_H_
7 #define LIBRARIES_SDK_UTIL_SCOPED_REF_H_ 7 #define LIBRARIES_SDK_UTIL_SCOPED_REF_H_
8 8
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
11 #include "sdk_util/macros.h" 11 #include "sdk_util/macros.h"
12 #include "sdk_util/ref_object.h" 12 #include "sdk_util/ref_object.h"
13 13
14 class ScopedRefBase { 14 class ScopedRefBase {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 template <typename U> 64 template <typename U>
65 bool operator!=(const ScopedRef<U>& p) const { 65 bool operator!=(const ScopedRef<U>& p) const {
66 return get() != p.get(); 66 return get() != p.get();
67 } 67 }
68 68
69 public: 69 public:
70 T& operator*() const { return *get(); } 70 T& operator*() const { return *get(); }
71 T* operator->() const { return get(); } 71 T* operator->() const { return get(); }
72 72
73 // Provided for Map and Set
74 bool operator<(const ScopedRef& other) const {
binji 2013/07/17 22:23:20 Now that I've seen the use case, you could just ad
noelallen1 2013/07/18 22:18:16 Done.
75 return ptr_ < other.ptr_;
76 }
77
73 private: 78 private:
74 typedef void (ScopedRef::*bool_as_func_ptr)() const; 79 typedef void (ScopedRef::*bool_as_func_ptr)() const;
75 void bool_as_func_impl() const {}; 80 void bool_as_func_impl() const {};
76 81
77 public: 82 public:
78 operator bool_as_func_ptr() const { 83 operator bool_as_func_ptr() const {
79 return (ptr_ != NULL) ? &ScopedRef::bool_as_func_impl : 0; 84 return (ptr_ != NULL) ? &ScopedRef::bool_as_func_impl : 0;
80 } 85 }
81 }; 86 };
82 87
83 #endif // LIBRARIES_SDK_UTIL_SCOPED_REF_H_ 88 #endif // LIBRARIES_SDK_UTIL_SCOPED_REF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698