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

Unified Diff: base/scoped_ptr.h

Issue 4683003: Sending the proto files for review to unblcok the server team Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/engine/read_node_mock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/scoped_ptr.h
diff --git a/base/scoped_ptr.h b/base/scoped_ptr.h
index 88ee41be94d5b8b880a6bb0c4ad95022b7425952..5d52dd1482f7c070b795f961668ea7af49db672a 100644
--- a/base/scoped_ptr.h
+++ b/base/scoped_ptr.h
@@ -122,6 +122,20 @@ class scoped_ptr {
return retVal;
}
+ // Gets a pointer to the pointer.
+ // Useful in case where we need to pass this pointer to pointer to
+ // a function and the function fills the pointer.
+ // If pointer_to were unavailable then we would have to
+ // do some thing like: C* p; GetMeTheObject(&p); scoped_ptr sp(p);
+ // With this we can just call GetMeTheObject(sp.pointer_to())
+ C** pointer_to() {
+ CHECK(ptr_ == NULL);// we could do a reset here which would release
+ // pointer but cause subtle bugs difficult to track
+ // down. So instead crash right away.
+
+ return &ptr_;
+ }
+
private:
C* ptr_;
« no previous file with comments | « no previous file | chrome/browser/sync/engine/read_node_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698