Use Local instead of Handle

This commit is contained in:
Cheng Zhao 2015-05-22 19:11:22 +08:00
parent b169ac016e
commit d78efe7c22
54 changed files with 185 additions and 185 deletions

View file

@ -12,7 +12,7 @@ namespace mate {
// static
bool Converter<ui::Accelerator>::FromV8(
v8::Isolate* isolate, v8::Handle<v8::Value> val, ui::Accelerator* out) {
v8::Isolate* isolate, v8::Local<v8::Value> val, ui::Accelerator* out) {
std::string keycode;
if (!ConvertFromV8(isolate, val, &keycode))
return false;

View file

@ -15,7 +15,7 @@ namespace mate {
template<>
struct Converter<ui::Accelerator> {
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
ui::Accelerator* out);
};

View file

@ -14,12 +14,12 @@ namespace mate {
template<>
struct Converter<base::FilePath> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::FilePath& val) {
return Converter<base::FilePath::StringType>::ToV8(isolate, val.value());
}
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
base::FilePath* out) {
base::FilePath::StringType path;
if (Converter<base::FilePath::StringType>::FromV8(isolate, val, &path)) {

View file

@ -12,7 +12,7 @@
namespace mate {
v8::Handle<v8::Value> Converter<gfx::Point>::ToV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Point>::ToV8(v8::Isolate* isolate,
const gfx::Point& val) {
mate::Dictionary dict(isolate, v8::Object::New(isolate));
dict.Set("x", val.x());
@ -21,7 +21,7 @@ v8::Handle<v8::Value> Converter<gfx::Point>::ToV8(v8::Isolate* isolate,
}
bool Converter<gfx::Point>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Point* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
@ -33,7 +33,7 @@ bool Converter<gfx::Point>::FromV8(v8::Isolate* isolate,
return true;
}
v8::Handle<v8::Value> Converter<gfx::Size>::ToV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Size>::ToV8(v8::Isolate* isolate,
const gfx::Size& val) {
mate::Dictionary dict(isolate, v8::Object::New(isolate));
dict.Set("width", val.width());
@ -42,7 +42,7 @@ v8::Handle<v8::Value> Converter<gfx::Size>::ToV8(v8::Isolate* isolate,
}
bool Converter<gfx::Size>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Size* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
@ -54,7 +54,7 @@ bool Converter<gfx::Size>::FromV8(v8::Isolate* isolate,
return true;
}
v8::Handle<v8::Value> Converter<gfx::Rect>::ToV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Rect>::ToV8(v8::Isolate* isolate,
const gfx::Rect& val) {
mate::Dictionary dict(isolate, v8::Object::New(isolate));
dict.Set("x", val.x());
@ -65,7 +65,7 @@ v8::Handle<v8::Value> Converter<gfx::Rect>::ToV8(v8::Isolate* isolate,
}
bool Converter<gfx::Rect>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Rect* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
@ -80,7 +80,7 @@ bool Converter<gfx::Rect>::FromV8(v8::Isolate* isolate,
template<>
struct Converter<gfx::Display::TouchSupport> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Display::TouchSupport& val) {
switch (val) {
case gfx::Display::TOUCH_SUPPORT_AVAILABLE:
@ -93,7 +93,7 @@ struct Converter<gfx::Display::TouchSupport> {
}
};
v8::Handle<v8::Value> Converter<gfx::Display>::ToV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Display>::ToV8(v8::Isolate* isolate,
const gfx::Display& val) {
mate::Dictionary dict(isolate, v8::Object::New(isolate));
dict.Set("id", val.id());

View file

@ -18,37 +18,37 @@ namespace mate {
template<>
struct Converter<gfx::Point> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Point& val);
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Point* out);
};
template<>
struct Converter<gfx::Size> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Size& val);
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Size* out);
};
template<>
struct Converter<gfx::Rect> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Rect& val);
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Rect* out);
};
template<>
struct Converter<gfx::Display> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Display& val);
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Display* out);
};

View file

@ -14,12 +14,12 @@ namespace mate {
template<>
struct Converter<GURL> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const GURL& val) {
return ConvertToV8(isolate, val.spec());
}
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
GURL* out) {
std::string url;
if (Converter<std::string>::FromV8(isolate, val, &url)) {

View file

@ -11,7 +11,7 @@
namespace mate {
bool Converter<gfx::ImageSkia>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::ImageSkia* out) {
gfx::Image image;
if (!ConvertFromV8(isolate, val, &image))
@ -22,7 +22,7 @@ bool Converter<gfx::ImageSkia>::FromV8(v8::Isolate* isolate,
}
bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Image* out) {
if (val->IsNull())
return true;
@ -43,7 +43,7 @@ bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
return true;
}
v8::Handle<v8::Value> Converter<gfx::Image>::ToV8(v8::Isolate* isolate,
v8::Local<v8::Value> Converter<gfx::Image>::ToV8(v8::Isolate* isolate,
const gfx::Image& val) {
return ConvertToV8(isolate, atom::api::NativeImage::Create(isolate, val));
}

View file

@ -17,16 +17,16 @@ namespace mate {
template<>
struct Converter<gfx::ImageSkia> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::ImageSkia* out);
};
template<>
struct Converter<gfx::Image> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
gfx::Image* out);
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const gfx::Image& val);
};

View file

@ -12,13 +12,13 @@ namespace mate {
template<>
struct Converter<base::string16> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::string16& val) {
return MATE_STRING_NEW_FROM_UTF16(
isolate, reinterpret_cast<const uint16_t*>(val.data()), val.size());
}
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
base::string16* out) {
if (!val->IsString())
return false;

View file

@ -46,7 +46,7 @@ class V8ValueConverter::FromV8ValueState {
// other handle B in the map points to the same object as A. Note that A can
// be unique even if there already is another handle with the same identity
// hash (key) in the map, because two objects can have the same hash.
bool UpdateAndCheckUniqueness(v8::Handle<v8::Object> handle) {
bool UpdateAndCheckUniqueness(v8::Local<v8::Object> handle) {
typedef HashToHandleMap::const_iterator Iterator;
int hash = handle->GetIdentityHash();
// We only compare using == with handles to objects with the same identity
@ -67,7 +67,7 @@ class V8ValueConverter::FromV8ValueState {
}
private:
typedef std::multimap<int, v8::Handle<v8::Object> > HashToHandleMap;
typedef std::multimap<int, v8::Local<v8::Object> > HashToHandleMap;
HashToHandleMap unique_map_;
int max_recursion_depth_;
@ -202,7 +202,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Object(
base::Value* V8ValueConverter::FromV8ValueImpl(
FromV8ValueState* state,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
v8::Isolate* isolate) const {
CHECK(!val.IsEmpty());
@ -267,7 +267,7 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
}
base::Value* V8ValueConverter::FromV8Array(
v8::Handle<v8::Array> val,
v8::Local<v8::Array> val,
FromV8ValueState* state,
v8::Isolate* isolate) const {
if (!state->UpdateAndCheckUniqueness(val))

View file

@ -43,9 +43,9 @@ class V8ValueConverter {
const base::DictionaryValue* dictionary) const;
base::Value* FromV8ValueImpl(FromV8ValueState* state,
v8::Handle<v8::Value> value,
v8::Local<v8::Value> value,
v8::Isolate* isolate) const;
base::Value* FromV8Array(v8::Handle<v8::Array> array,
base::Value* FromV8Array(v8::Local<v8::Array> array,
FromV8ValueState* state,
v8::Isolate* isolate) const;

View file

@ -10,7 +10,7 @@
namespace mate {
bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
base::DictionaryValue* out) {
scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
scoped_ptr<base::Value> value(converter->FromV8Value(
@ -24,7 +24,7 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
}
bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
base::ListValue* out) {
scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);
scoped_ptr<base::Value> value(converter->FromV8Value(
@ -37,7 +37,7 @@ bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
}
}
v8::Handle<v8::Value> Converter<base::ListValue>::ToV8(
v8::Local<v8::Value> Converter<base::ListValue>::ToV8(
v8::Isolate* isolate,
const base::ListValue& val) {
scoped_ptr<atom::V8ValueConverter> converter(new atom::V8ValueConverter);

View file

@ -17,16 +17,16 @@ namespace mate {
template<>
struct Converter<base::DictionaryValue> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
base::DictionaryValue* out);
};
template<>
struct Converter<base::ListValue> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
base::ListValue* out);
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::ListValue& val);
};