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

Side by Side Diff: media/cdm/ppapi/linked_ptr.h

Issue 26155003: Add CdmWrapper to support multiple CDM versions in CdmAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | 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 //
5 // This is a copy of base/linked_ptr.h with CHECKS/DCHECKS replaced with 5 // This is a copy of base/linked_ptr.h with CHECKS/DCHECKS replaced with
6 // PP_DCHECKs. 6 // PP_DCHECKs.
7 // 7 //
8 // A "smart" pointer type with reference tracking. Every pointer to a 8 // A "smart" pointer type with reference tracking. Every pointer to a
9 // particular object is kept on a circular linked list. When the last pointer 9 // particular object is kept on a circular linked list. When the last pointer
10 // to an object is destroyed or reassigned, the object is deleted. 10 // to an object is destroyed or reassigned, the object is deleted.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 return *this; 109 return *this;
110 } 110 }
111 111
112 // Smart pointer members. 112 // Smart pointer members.
113 void reset(T* ptr = NULL) { 113 void reset(T* ptr = NULL) {
114 depart(); 114 depart();
115 capture(ptr); 115 capture(ptr);
116 } 116 }
117 T* get() const { return value_; } 117 T* get() const { return value_; }
118 operator T*() const { return value_; }
ddorwin 2013/10/18 22:17:01 You probably don't need this based on my comments.
xhwang 2013/10/18 23:03:52 It's used in a lot of places in CdmAdapter. So I'd
ddorwin 2013/10/18 23:45:56 As discussed, this is fine.
118 T* operator->() const { return value_; } 119 T* operator->() const { return value_; }
119 T& operator*() const { return *value_; } 120 T& operator*() const { return *value_; }
120 // Release ownership of the pointed object and returns it. 121 // Release ownership of the pointed object and returns it.
121 // Sole ownership by this linked_ptr object is required. 122 // Sole ownership by this linked_ptr object is required.
122 T* release() { 123 T* release() {
123 bool last = link_.depart(); 124 bool last = link_.depart();
124 PP_DCHECK(last); 125 PP_DCHECK(last);
125 (void)last; 126 (void)last;
126 T* v = value_; 127 T* v = value_;
127 value_ = NULL; 128 value_ = NULL;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 177
177 // A function to convert T* into linked_ptr<T> 178 // A function to convert T* into linked_ptr<T>
178 // Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation 179 // Doing e.g. make_linked_ptr(new FooBarBaz<type>(arg)) is a shorter notation
179 // for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg)) 180 // for linked_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
180 template <typename T> 181 template <typename T>
181 linked_ptr<T> make_linked_ptr(T* ptr) { 182 linked_ptr<T> make_linked_ptr(T* ptr) {
182 return linked_ptr<T>(ptr); 183 return linked_ptr<T>(ptr);
183 } 184 }
184 185
185 #endif // MEDIA_CDM_PPAPI_LINKED_PTR_H_ 186 #endif // MEDIA_CDM_PPAPI_LINKED_PTR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698