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

Side by Side Diff: gin/wrappable.h

Issue 89723002: Convert the rest of the functions in core.cc to use CreateFunctionTemplate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase+comments Created 7 years 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
« no previous file with comments | « gin/runner_unittest.cc ('k') | gin/wrappable.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 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 #ifndef GIN_WRAPPABLE_H_ 5 #ifndef GIN_WRAPPABLE_H_
6 #define GIN_WRAPPABLE_H_ 6 #define GIN_WRAPPABLE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "gin/converter.h" 9 #include "gin/converter.h"
10 #include "gin/public/wrapper_info.h" 10 #include "gin/public/wrapper_info.h"
(...skipping 20 matching lines...) Expand all
31 31
32 v8::Persistent<v8::Object> wrapper_; // Weak 32 v8::Persistent<v8::Object> wrapper_; // Weak
33 33
34 DISALLOW_COPY_AND_ASSIGN(Wrappable); 34 DISALLOW_COPY_AND_ASSIGN(Wrappable);
35 }; 35 };
36 36
37 template<> 37 template<>
38 struct Converter<Wrappable*> { 38 struct Converter<Wrappable*> {
39 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, 39 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
40 Wrappable* val); 40 Wrappable* val);
41 static bool FromV8(v8::Handle<v8::Value> val, 41 static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
42 Wrappable** out); 42 Wrappable** out);
43 }; 43 };
44 44
45 template<typename T> 45 template<typename T>
46 struct WrappableConverter { 46 struct WrappableConverter {
47 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, T* val) { 47 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, T* val) {
48 return Converter<Wrappable*>::ToV8(isolate, val); 48 return Converter<Wrappable*>::ToV8(isolate, val);
49 } 49 }
50 static bool FromV8(v8::Handle<v8::Value> val, T** out) { 50 static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val, T** out) {
51 Wrappable* wrappable = 0; 51 Wrappable* wrappable = 0;
52 if (!Converter<Wrappable*>::FromV8(val, &wrappable) 52 if (!Converter<Wrappable*>::FromV8(isolate, val, &wrappable)
53 || wrappable->GetWrapperInfo() != &T::kWrapperInfo) 53 || wrappable->GetWrapperInfo() != &T::kWrapperInfo)
54 return false; 54 return false;
55 *out = static_cast<T*>(wrappable); 55 *out = static_cast<T*>(wrappable);
56 return true; 56 return true;
57 } 57 }
58 }; 58 };
59 59
60 } // namespace gin 60 } // namespace gin
61 61
62 #endif // GIN_WRAPPABLE_H_ 62 #endif // GIN_WRAPPABLE_H_
OLDNEW
« no previous file with comments | « gin/runner_unittest.cc ('k') | gin/wrappable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698