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

Unified Diff: gin/unsafe_persistent.h

Issue 172263002: Move WebAXObjectProxy and AccessibleController from CppBoundClass to gin::Wrappable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gin/gin.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/unsafe_persistent.h
diff --git a/chrome/renderer/extensions/unsafe_persistent.h b/gin/unsafe_persistent.h
similarity index 73%
copy from chrome/renderer/extensions/unsafe_persistent.h
copy to gin/unsafe_persistent.h
index f8fa9bbd42acfa9a57eb531dbb17c4b37ce49c38..8a34a8591cf00cd0e2837311e3401b318497d9ba 100644
--- a/chrome/renderer/extensions/unsafe_persistent.h
+++ b/gin/unsafe_persistent.h
@@ -1,13 +1,13 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_RENDERER_EXTENSIONS_UNSAFE_PERSISTENT_H_
-#define CHROME_RENDERER_EXTENSIONS_UNSAFE_PERSISTENT_H_
+#ifndef GIN_UNSAFE_PERSISTENT_H_
+#define GIN_UNSAFE_PERSISTENT_H_
#include "v8/include/v8.h"
-namespace extensions {
+namespace gin {
// An unsafe way to pass Persistent handles around. Do not use unless you know
// what you're doing. UnsafePersistent is only safe to use when we know that the
@@ -27,9 +27,21 @@ template<typename T> class UnsafePersistent {
value_ = persistent.ClearAndLeak();
}
+ UnsafePersistent(const UnsafePersistent& other) {
+ value_ = other.value_;
+ }
kouhei (in TOK) 2014/02/21 01:27:26 You also need to define operator= and destructor w
hajimehoshi 2014/02/21 11:07:23 Done. (Removed and used the default copy construct
+
+ T* Value() const {
+ return value_;
+ }
+
+ T* operator ->() const {
+ return value_;
+ }
+
// Usage of this function requires
// V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR to be defined
- void dispose() {
+ void Dispose() {
v8::Persistent<T> handle(value_);
handle.Reset();
value_ = 0;
@@ -37,7 +49,7 @@ template<typename T> class UnsafePersistent {
// Usage of this function requires
// V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR to be defined
- v8::Local<T> newLocal(v8::Isolate* isolate) {
+ v8::Local<T> NewLocal(v8::Isolate* isolate) {
return v8::Local<T>::New(isolate, v8::Local<T>(value_));
}
@@ -45,6 +57,6 @@ template<typename T> class UnsafePersistent {
T* value_;
};
-} // namespace extensions
+} // namespace gin
-#endif // CHROME_RENDERER_EXTENSIONS_UNSAFE_PERSISTENT_H_
+#endif // GIN_UNSAFE_PERSISTENT_H_
« no previous file with comments | « gin/gin.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698