#if defined(OS_WIN)
template<>
struct Converter<Browser::UserTask> {
- static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
Browser::UserTask* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
}
#endif
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
auto command_line = base::CommandLine::ForCurrentProcess();
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("autoUpdater", atom::api::AutoUpdater::Create(isolate));
template<>
struct Converter<base::trace_event::CategoryFilter> {
static bool FromV8(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
+ v8::Local<v8::Value> val,
base::trace_event::CategoryFilter* out) {
std::string filter;
if (!ConvertFromV8(isolate, val, &filter))
template<>
struct Converter<base::trace_event::TraceOptions> {
static bool FromV8(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
+ v8::Local<v8::Value> val,
base::trace_event::TraceOptions* out) {
std::string options;
if (!ConvertFromV8(isolate, val, &options))
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
auto controller = base::Unretained(TracingController::GetInstance());
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("getCategories", base::Bind(
template<>
struct Converter<file_dialog::Filter> {
static bool FromV8(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
+ v8::Local<v8::Value> val,
file_dialog::Filter* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
const std::string& message = texts[1];
const std::string& detail = texts[2];
- v8::Handle<v8::Value> peek = args->PeekNext();
+ v8::Local<v8::Value> peek = args->PeekNext();
atom::MessageBoxCallback callback;
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
peek,
int properties,
atom::NativeWindow* window,
mate::Arguments* args) {
- v8::Handle<v8::Value> peek = args->PeekNext();
+ v8::Local<v8::Value> peek = args->PeekNext();
file_dialog::OpenDialogCallback callback;
if (mate::Converter<file_dialog::OpenDialogCallback>::FromV8(args->isolate(),
peek,
const file_dialog::Filters& filters,
atom::NativeWindow* window,
mate::Arguments* args) {
- v8::Handle<v8::Value> peek = args->PeekNext();
+ v8::Local<v8::Value> peek = args->PeekNext();
file_dialog::SaveDialogCallback callback;
if (mate::Converter<file_dialog::SaveDialogCallback>::FromV8(args->isolate(),
peek,
}
}
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("showMessageBox", &ShowMessageBox);
dict.SetMethod("showErrorBox", &atom::ShowErrorBox);
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("globalShortcut", atom::api::GlobalShortcut::Create(isolate));
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
- v8::Handle<v8::Value> val = get_accelerator_.Run(command_id);
+ v8::Local<v8::Value> val = get_accelerator_.Run(command_id);
return mate::ConvertFromV8(isolate, val, accelerator);
}
// static
void Menu::BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype) {
+ v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("insertItem", &Menu::InsertItemAt)
.SetMethod("insertCheckItem", &Menu::InsertCheckItemAt)
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
using atom::api::Menu;
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<Menu>(
isolate, "Menu", base::Bind(&Menu::Create));
mate::Dictionary dict(isolate, exports);
- dict.Set("Menu", static_cast<v8::Handle<v8::Value>>(constructor));
+ dict.Set("Menu", static_cast<v8::Local<v8::Value>>(constructor));
#if defined(OS_MACOSX)
dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu);
dict.SetMethod("sendActionToFirstResponder",
static mate::Wrappable* Create();
static void BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype);
+ v8::Local<v8::ObjectTemplate> prototype);
#if defined(OS_MACOSX)
// Set the global menubar.
base::Callback<bool(int)> is_checked_;
base::Callback<bool(int)> is_enabled_;
base::Callback<bool(int)> is_visible_;
- base::Callback<v8::Handle<v8::Value>(int)> get_accelerator_;
+ base::Callback<v8::Local<v8::Value>(int)> get_accelerator_;
base::Callback<void(int)> execute_command_;
base::Callback<void()> menu_will_show_;
}
// static
-v8::Handle<v8::Value> PowerMonitor::Create(v8::Isolate* isolate) {
+v8::Local<v8::Value> PowerMonitor::Create(v8::Isolate* isolate) {
if (!Browser::Get()->is_ready()) {
node::ThrowError("Cannot initialize \"power-monitor\" module"
"before app is ready");
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
#if defined(OS_MACOSX)
base::PowerMonitorDeviceSource::AllocateSystemIOPorts();
#endif
class PowerMonitor : public mate::EventEmitter,
public base::PowerObserver {
public:
- static v8::Handle<v8::Value> Create(v8::Isolate* isolate);
+ static v8::Local<v8::Value> Create(v8::Isolate* isolate);
protected:
PowerMonitor();
template<>
struct Converter<const net::URLRequest*> {
- static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
+ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const net::URLRequest* val) {
return mate::ObjectTemplateBuilder(isolate)
.SetValue("method", val->method())
// Call the JS handler.
Protocol::JsProtocolHandler callback =
registry_->GetProtocolHandler(request()->url().scheme());
- v8::Handle<v8::Value> result = callback.Run(request());
+ v8::Local<v8::Value> result = callback.Run(request());
// Determine the type of the job we are going to create.
if (result->IsString()) {
GetWeakPtr(), "text/plain", "UTF-8", data));
return;
} else if (result->IsObject()) {
- v8::Handle<v8::Object> obj = result->ToObject();
+ v8::Local<v8::Object> obj = result->ToObject();
mate::Dictionary dict(isolate, obj);
std::string name = mate::V8ToString(obj->GetConstructorName());
if (name == "RequestStringJob") {
return;
} else if (name == "RequestBufferJob") {
std::string mime_type, encoding;
- v8::Handle<v8::Value> buffer;
+ v8::Local<v8::Value> buffer;
dict.Get("mimeType", &mime_type);
dict.Get("encoding", &encoding);
dict.Get("data", &buffer);
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("protocol", atom::api::Protocol::Create(isolate));
class Protocol : public mate::EventEmitter {
public:
- typedef base::Callback<v8::Handle<v8::Value>(const net::URLRequest*)>
+ typedef base::Callback<v8::Local<v8::Value>(const net::URLRequest*)>
JsProtocolHandler;
static mate::Handle<Protocol> Create(v8::Isolate* isolate);
}
// static
-v8::Handle<v8::Value> Screen::Create(v8::Isolate* isolate) {
+v8::Local<v8::Value> Screen::Create(v8::Isolate* isolate) {
if (!Browser::Get()->is_ready()) {
node::ThrowError("Cannot initialize \"screen\" module before app is ready");
return v8::Null(isolate);
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.Set("screen", atom::api::Screen::Create(context->GetIsolate()));
}
class Screen : public mate::EventEmitter,
public gfx::DisplayObserver {
public:
- static v8::Handle<v8::Value> Create(v8::Isolate* isolate);
+ static v8::Local<v8::Value> Create(v8::Isolate* isolate);
protected:
explicit Screen(gfx::Screen* screen);
// static
void Tray::BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype) {
+ v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("destroy", &Tray::Destroy)
.SetMethod("setImage", &Tray::SetImage)
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
using atom::api::Tray;
v8::Isolate* isolate = context->GetIsolate();
- v8::Handle<v8::Function> constructor = mate::CreateConstructor<Tray>(
+ v8::Local<v8::Function> constructor = mate::CreateConstructor<Tray>(
isolate, "Tray", base::Bind(&Tray::New));
mate::Dictionary dict(isolate, exports);
- dict.Set("Tray", static_cast<v8::Handle<v8::Value>>(constructor));
+ dict.Set("Tray", static_cast<v8::Local<v8::Value>>(constructor));
}
} // namespace
static mate::Wrappable* New(const gfx::Image& image);
static void BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype);
+ v8::Local<v8::ObjectTemplate> prototype);
protected:
explicit Tray(const gfx::Image& image);
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.SetMethod("create", &atom::api::WebContents::Create);
template<>
struct Converter<content::WebContents*> {
- static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
content::WebContents** out) {
atom::api::WebContents* contents;
if (!Converter<atom::api::WebContents*>::FromV8(isolate, val, &contents))
template<>
struct Converter<atom::WebViewManager::WebViewInfo> {
- static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
atom::WebViewManager::WebViewInfo* out) {
Dictionary options;
if (!ConvertFromV8(isolate, val, &options))
manager->RemoveGuest(guest_instance_id);
}
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("addGuest", &AddGuest);
dict.SetMethod("removeGuest", &RemoveGuest);
template<>
struct Converter<PrintSettings> {
- static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
PrintSettings* out) {
mate::Dictionary dict;
if (!ConvertFromV8(isolate, val, &dict))
// static
void Window::BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype) {
+ v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("destroy", &Window::Destroy)
.SetMethod("close", &Window::Close)
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
using atom::api::Window;
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<Window>(
isolate, "BrowserWindow", base::Bind(&Window::New));
mate::Dictionary dict(isolate, exports);
- dict.Set("BrowserWindow", static_cast<v8::Handle<v8::Value>>(constructor));
+ dict.Set("BrowserWindow", static_cast<v8::Local<v8::Value>>(constructor));
}
} // namespace
const mate::Dictionary& options);
static void BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype);
+ v8::Local<v8::ObjectTemplate> prototype);
NativeWindow* window() const { return window_.get(); }
template<>
struct Converter<atom::NativeWindow*> {
- static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
atom::NativeWindow** out) {
// null would be tranfered to NULL.
if (val->IsNull()) {
content::WebContents* sender,
IPC::Message* message,
ValueArray args) {
- v8::Handle<v8::Object> event;
+ v8::Local<v8::Object> event;
bool use_native_event = sender && message;
if (use_native_event) {
mate::Handle<mate::Event> native_event = mate::Event::Create(isolate);
native_event->SetSenderAndMessage(sender, message);
- event = v8::Handle<v8::Object>::Cast(native_event.ToV8());
+ event = v8::Local<v8::Object>::Cast(native_event.ToV8());
} else {
event = CreateEventObject(isolate);
}
// Provide helperers to emit event in JavaScript.
class EventEmitter : public Wrappable {
public:
- typedef std::vector<v8::Handle<v8::Value>> ValueArray;
+ typedef std::vector<v8::Local<v8::Value>> ValueArray;
protected:
EventEmitter();
class Archive : public mate::Wrappable {
public:
- static v8::Handle<v8::Value> Create(v8::Isolate* isolate,
+ static v8::Local<v8::Value> Create(v8::Isolate* isolate,
const base::FilePath& path) {
scoped_ptr<asar::Archive> archive(new asar::Archive(path));
if (!archive->Init())
: archive_(archive.Pass()) {}
// Reads the offset and size of file.
- v8::Handle<v8::Value> GetFileInfo(v8::Isolate* isolate,
+ v8::Local<v8::Value> GetFileInfo(v8::Isolate* isolate,
const base::FilePath& path) {
asar::Archive::FileInfo info;
if (!archive_ || !archive_->GetFileInfo(path, &info))
}
// Returns a fake result of fs.stat(path).
- v8::Handle<v8::Value> Stat(v8::Isolate* isolate,
+ v8::Local<v8::Value> Stat(v8::Isolate* isolate,
const base::FilePath& path) {
asar::Archive::Stats stats;
if (!archive_ || !archive_->Stat(path, &stats))
}
// Returns all files under a directory.
- v8::Handle<v8::Value> Readdir(v8::Isolate* isolate,
+ v8::Local<v8::Value> Readdir(v8::Isolate* isolate,
const base::FilePath& path) {
std::vector<base::FilePath> files;
if (!archive_ || !archive_->Readdir(path, &files))
}
// Returns the path of file with symbol link resolved.
- v8::Handle<v8::Value> Realpath(v8::Isolate* isolate,
+ v8::Local<v8::Value> Realpath(v8::Isolate* isolate,
const base::FilePath& path) {
base::FilePath realpath;
if (!archive_ || !archive_->Realpath(path, &realpath))
}
// Copy the file out into a temporary file and returns the new path.
- v8::Handle<v8::Value> CopyFileOut(v8::Isolate* isolate,
+ v8::Local<v8::Value> CopyFileOut(v8::Isolate* isolate,
const base::FilePath& path) {
base::FilePath new_path;
if (!archive_ || !archive_->CopyFileOut(path, &new_path))
};
void InitAsarSupport(v8::Isolate* isolate,
- v8::Handle<v8::Value> process,
- v8::Handle<v8::Value> require) {
+ v8::Local<v8::Value> process,
+ v8::Local<v8::Value> require) {
// Evaluate asar_init.coffee.
v8::Local<v8::Script> asar_init = v8::Script::Compile(v8::String::NewFromUtf8(
isolate,
v8::Local<v8::Value> result = asar_init->Run();
// Initialize asar support.
- base::Callback<void(v8::Handle<v8::Value>,
- v8::Handle<v8::Value>,
+ base::Callback<void(v8::Local<v8::Value>,
+ v8::Local<v8::Value>,
std::string)> init;
if (mate::ConvertFromV8(isolate, result, &init)) {
init.Run(process,
}
}
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("createArchive", &Archive::Create);
dict.SetMethod("initAsarSupport", &InitAsarSupport);
template<>
struct Converter<ui::ClipboardType> {
- static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+ static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
ui::ClipboardType* out) {
std::string type;
if (!Converter<std::string>::FromV8(isolate, val, &type))
ui::Clipboard::GetForCurrentThread()->Clear(type);
}
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("_has", &Has);
dict.SetMethod("_read", &Read);
template<>
struct Converter<std::map<std::string, std::string> > {
static bool FromV8(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
+ v8::Local<v8::Value> val,
std::map<std::string, std::string>* out) {
if (!val->IsObject())
return false;
- v8::Handle<v8::Object> dict = val->ToObject();
- v8::Handle<v8::Array> keys = dict->GetOwnPropertyNames();
+ v8::Local<v8::Object> dict = val->ToObject();
+ v8::Local<v8::Array> keys = dict->GetOwnPropertyNames();
for (uint32_t i = 0; i < keys->Length(); ++i) {
- v8::Handle<v8::Value> key = keys->Get(i);
+ v8::Local<v8::Value> key = keys->Get(i);
(*out)[V8ToString(key)] = V8ToString(dict->Get(key));
}
return true;
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
using crash_reporter::CrashReporter;
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("start",
IDWeakMap::~IDWeakMap() {
}
-int32_t IDWeakMap::Add(v8::Isolate* isolate, v8::Handle<v8::Object> object) {
+int32_t IDWeakMap::Add(v8::Isolate* isolate, v8::Local<v8::Object> object) {
int32_t key = GetNextID();
object->SetHiddenValue(mate::StringToV8(isolate, "IDWeakMapKey"),
mate::Converter<int32_t>::ToV8(isolate, key));
return key;
}
-v8::Handle<v8::Value> IDWeakMap::Get(v8::Isolate* isolate, int32_t key) {
+v8::Local<v8::Value> IDWeakMap::Get(v8::Isolate* isolate, int32_t key) {
if (!Has(key)) {
node::ThrowError("Invalid key");
return v8::Undefined(isolate);
// static
void IDWeakMap::BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype) {
+ v8::Local<v8::ObjectTemplate> prototype) {
mate::ObjectTemplateBuilder(isolate, prototype)
.SetMethod("add", &IDWeakMap::Add)
.SetMethod("get", &IDWeakMap::Get)
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
using atom::api::IDWeakMap;
v8::Isolate* isolate = context->GetIsolate();
v8::Local<v8::Function> constructor = mate::CreateConstructor<IDWeakMap>(
IDWeakMap();
static void BuildPrototype(v8::Isolate* isolate,
- v8::Handle<v8::ObjectTemplate> prototype);
+ v8::Local<v8::ObjectTemplate> prototype);
private:
virtual ~IDWeakMap();
- int32_t Add(v8::Isolate* isolate, v8::Handle<v8::Object> object);
- v8::Handle<v8::Value> Get(v8::Isolate* isolate, int32_t key);
+ int32_t Add(v8::Isolate* isolate, v8::Local<v8::Object> object);
+ v8::Local<v8::Value> Get(v8::Isolate* isolate, int32_t key);
bool Has(int32_t key) const;
std::vector<int32_t> Keys() const;
void Remove(int32_t key);
isolate, v8::Local<v8::ObjectTemplate>::New(isolate, template_));
}
-v8::Handle<v8::Value> NativeImage::ToPNG(v8::Isolate* isolate) {
+v8::Local<v8::Value> NativeImage::ToPNG(v8::Isolate* isolate) {
scoped_refptr<base::RefCountedMemory> png = image_.As1xPNGBytes();
return node::Buffer::New(isolate,
reinterpret_cast<const char*>(png->front()),
png->size());
}
-v8::Handle<v8::Value> NativeImage::ToJPEG(v8::Isolate* isolate, int quality) {
+v8::Local<v8::Value> NativeImage::ToJPEG(v8::Isolate* isolate, int quality) {
std::vector<unsigned char> output;
gfx::JPEG1xEncodedDataFromImage(image_, quality, &output);
return node::Buffer::New(isolate,
// static
mate::Handle<NativeImage> NativeImage::CreateFromBuffer(
- mate::Arguments* args, v8::Handle<v8::Value> buffer) {
+ mate::Arguments* args, v8::Local<v8::Value> buffer) {
double scale_factor = 1.;
args->GetNext(&scale_factor);
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("createEmpty", &atom::api::NativeImage::CreateEmpty);
dict.SetMethod("createFromPath", &atom::api::NativeImage::CreateFromPath);
static mate::Handle<NativeImage> CreateFromPath(
v8::Isolate* isolate, const base::FilePath& path);
static mate::Handle<NativeImage> CreateFromBuffer(
- mate::Arguments* args, v8::Handle<v8::Value> buffer);
+ mate::Arguments* args, v8::Local<v8::Value> buffer);
static mate::Handle<NativeImage> CreateFromDataURL(
v8::Isolate* isolate, const GURL& url);
v8::Isolate* isolate) override;
private:
- v8::Handle<v8::Value> ToPNG(v8::Isolate* isolate);
- v8::Handle<v8::Value> ToJPEG(v8::Isolate* isolate, int quality);
+ v8::Local<v8::Value> ToPNG(v8::Isolate* isolate);
+ v8::Local<v8::Value> ToJPEG(v8::Isolate* isolate, int quality);
std::string ToDataURL();
bool IsEmpty();
gfx::Size GetSize();
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder);
dict.SetMethod("openItem", &platform_util::OpenItem);
namespace {
-v8::Handle<v8::Object> CreateObjectWithName(v8::Isolate* isolate,
- v8::Handle<v8::String> name) {
+v8::Local<v8::Object> CreateObjectWithName(v8::Isolate* isolate,
+ v8::Local<v8::String> name) {
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
t->SetClassName(name);
return t->GetFunction()->NewInstance();
}
-v8::Handle<v8::Value> GetHiddenValue(v8::Handle<v8::Object> object,
- v8::Handle<v8::String> key) {
+v8::Local<v8::Value> GetHiddenValue(v8::Local<v8::Object> object,
+ v8::Local<v8::String> key) {
return object->GetHiddenValue(key);
}
-void SetHiddenValue(v8::Handle<v8::Object> object,
- v8::Handle<v8::String> key,
- v8::Handle<v8::Value> value) {
+void SetHiddenValue(v8::Local<v8::Object> object,
+ v8::Local<v8::String> key,
+ v8::Local<v8::Value> value) {
object->SetHiddenValue(key, value);
}
-int32_t GetObjectHash(v8::Handle<v8::Object> object) {
+int32_t GetObjectHash(v8::Local<v8::Object> object) {
return object->GetIdentityHash();
}
void SetDestructor(v8::Isolate* isolate,
- v8::Handle<v8::Object> object,
- v8::Handle<v8::Function> callback) {
+ v8::Local<v8::Object> object,
+ v8::Local<v8::Function> callback) {
atom::ObjectLifeMonitor::BindTo(isolate, object, callback);
}
isolate->GetHeapProfiler()->TakeHeapSnapshot();
}
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("createObjectWithName", &CreateObjectWithName);
dict.SetMethod("getHiddenValue", &GetHiddenValue);
}
void AtomBindings::BindTo(v8::Isolate* isolate,
- v8::Handle<v8::Object> process) {
+ v8::Local<v8::Object> process) {
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
mate::Dictionary dict(isolate, process);
// Add process.atomBinding function, which behaves like process.binding but
// load native code from atom-shell instead.
- void BindTo(v8::Isolate* isolate, v8::Handle<v8::Object> process);
+ void BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process);
private:
void ActivateUVLoop(v8::Isolate* isolate);
// static
void ObjectLifeMonitor::BindTo(v8::Isolate* isolate,
- v8::Handle<v8::Object> target,
- v8::Handle<v8::Value> destructor) {
+ v8::Local<v8::Object> target,
+ v8::Local<v8::Value> destructor) {
target->SetHiddenValue(MATE_STRING_NEW(isolate, "destructor"), destructor);
ObjectLifeMonitor* olm = new ObjectLifeMonitor();
class ObjectLifeMonitor {
public:
static void BindTo(v8::Isolate* isolate,
- v8::Handle<v8::Object> target,
- v8::Handle<v8::Value> destructor);
+ v8::Local<v8::Object> target,
+ v8::Local<v8::Value> destructor);
private:
ObjectLifeMonitor();
// 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;
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);
};
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)) {
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());
}
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))
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());
}
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))
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());
}
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))
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:
}
};
-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());
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);
};
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)) {
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))
}
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;
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));
}
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);
};
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;
// 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
}
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_;
base::Value* V8ValueConverter::FromV8ValueImpl(
FromV8ValueState* state,
- v8::Handle<v8::Value> val,
+ v8::Local<v8::Value> val,
v8::Isolate* isolate) const {
CHECK(!val.IsEmpty());
}
base::Value* V8ValueConverter::FromV8Array(
- v8::Handle<v8::Array> val,
+ v8::Local<v8::Array> val,
FromV8ValueState* state,
v8::Isolate* isolate) const {
if (!state->UpdateAndCheckUniqueness(val))
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;
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(
}
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(
}
}
-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);
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);
};
return json;
}
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("send", &Send);
dict.SetMethod("sendSync", &SendSync);
SpellCheckClient::SpellCheckClient(const std::string& language,
bool auto_spell_correct_turned_on,
v8::Isolate* isolate,
- v8::Handle<v8::Object> provider)
+ v8::Local<v8::Object> provider)
: auto_spell_correct_turned_on_(auto_spell_correct_turned_on),
isolate_(isolate),
provider_(isolate, provider) {
return true;
v8::HandleScope handle_scope(isolate_);
- v8::Handle<v8::Value> word = mate::ConvertToV8(isolate_, word_to_check);
- v8::Handle<v8::Value> result = spell_check_.NewHandle()->Call(
+ v8::Local<v8::Value> word = mate::ConvertToV8(isolate_, word_to_check);
+ v8::Local<v8::Value> result = spell_check_.NewHandle()->Call(
provider_.NewHandle(), 1, &word);
if (result->IsBoolean())
SpellCheckClient(const std::string& language,
bool auto_spell_correct_turned_on,
v8::Isolate* isolate,
- v8::Handle<v8::Object> provider);
+ v8::Local<v8::Object> provider);
virtual ~SpellCheckClient();
private:
template<>
struct Converter<WTF::String> {
static bool FromV8(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
+ v8::Local<v8::Value> val,
WTF::String* out) {
if (!val->IsString())
return false;
return blink::WebView::zoomLevelToZoomFactor(GetZoomLevel());
}
-v8::Handle<v8::Value> WebFrame::RegisterEmbedderCustomElement(
- const base::string16& name, v8::Handle<v8::Object> options) {
+v8::Local<v8::Value> WebFrame::RegisterEmbedderCustomElement(
+ const base::string16& name, v8::Local<v8::Object> options) {
blink::WebExceptionCode c = 0;
return web_frame_->document().registerEmbedderCustomElement(name, options, c);
}
void WebFrame::SetSpellCheckProvider(mate::Arguments* args,
const std::string& language,
bool auto_spell_correct_turned_on,
- v8::Handle<v8::Object> provider) {
+ v8::Local<v8::Object> provider) {
if (!provider->Has(mate::StringToV8(args->isolate(), "spellCheck"))) {
args->ThrowError("\"spellCheck\" has to be defined");
return;
namespace {
-void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
- v8::Handle<v8::Context> context, void* priv) {
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("webFrame", atom::api::WebFrame::Create(isolate));
double SetZoomFactor(double factor);
double GetZoomFactor() const;
- v8::Handle<v8::Value> RegisterEmbedderCustomElement(
- const base::string16& name, v8::Handle<v8::Object> options);
+ v8::Local<v8::Value> RegisterEmbedderCustomElement(
+ const base::string16& name, v8::Local<v8::Object> options);
void AttachGuest(int element_instance_id);
// Set the provider that will be used by SpellCheckClient for spell check.
void SetSpellCheckProvider(mate::Arguments* args,
const std::string& language,
bool auto_spell_correct_turned_on,
- v8::Handle<v8::Object> provider);
+ v8::Local<v8::Object> provider);
// mate::Wrappable:
virtual mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
namespace {
bool GetIPCObject(v8::Isolate* isolate,
- v8::Handle<v8::Context> context,
- v8::Handle<v8::Object>* ipc) {
- v8::Handle<v8::String> key = mate::StringToV8(isolate, "ipc");
- v8::Handle<v8::Value> value = context->Global()->GetHiddenValue(key);
+ v8::Local<v8::Context> context,
+ v8::Local<v8::Object>* ipc) {
+ v8::Local<v8::String> key = mate::StringToV8(isolate, "ipc");
+ v8::Local<v8::Value> value = context->Global()->GetHiddenValue(key);
if (value.IsEmpty() || !value->IsObject())
return false;
*ipc = value->ToObject();
return true;
}
-std::vector<v8::Handle<v8::Value>> ListValueToVector(
+std::vector<v8::Local<v8::Value>> ListValueToVector(
v8::Isolate* isolate,
const base::ListValue& list) {
- v8::Handle<v8::Value> array = mate::ConvertToV8(isolate, list);
- std::vector<v8::Handle<v8::Value>> result;
+ v8::Local<v8::Value> array = mate::ConvertToV8(isolate, list);
+ std::vector<v8::Local<v8::Value>> result;
mate::ConvertFromV8(isolate, array, &result);
return result;
}
v8::Local<v8::Context> context = frame->mainWorldScriptContext();
v8::Context::Scope context_scope(context);
- std::vector<v8::Handle<v8::Value>> arguments = ListValueToVector(
+ std::vector<v8::Local<v8::Value>> arguments = ListValueToVector(
isolate, args);
arguments.insert(arguments.begin(), mate::ConvertToV8(isolate, channel));
- v8::Handle<v8::Object> ipc;
+ v8::Local<v8::Object> ipc;
if (GetIPCObject(isolate, context, &ipc))
node::MakeCallback(isolate, ipc, "emit", arguments.size(), &arguments[0]);
}
-Subproject commit 047a8de9342a3217a8d8316f77b9276e8eb7a649
+Subproject commit 269be869988bda9a7e8ad0ef56af178a741af09c