From d53915c6ab7753adf1efb737481b07facb483900 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 11 Dec 2013 23:57:37 +0800 Subject: [PATCH] Fix recursive calling of handle(). --- browser/api/atom_api_event_emitter.h | 5 ----- browser/api/atom_api_menu.cc | 12 ++++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/browser/api/atom_api_event_emitter.h b/browser/api/atom_api_event_emitter.h index 959d4b7f9b17..dd2292238601 100644 --- a/browser/api/atom_api_event_emitter.h +++ b/browser/api/atom_api_event_emitter.h @@ -29,11 +29,6 @@ class EventEmitter : public node::ObjectWrap { bool Emit(const std::string& name); bool Emit(const std::string& name, base::ListValue* args); - // The handle() of ObjectWrap doesn't provide the const version. - inline v8::Local handle() const { - return const_cast(this)->handle(); - } - protected: explicit EventEmitter(v8::Handle wrapper); diff --git a/browser/api/atom_api_menu.cc b/browser/api/atom_api_menu.cc index 814cdc75f413..4367dac6c0b6 100644 --- a/browser/api/atom_api_menu.cc +++ b/browser/api/atom_api_menu.cc @@ -54,7 +54,7 @@ Menu::~Menu() { bool Menu::IsCommandIdChecked(int command_id) const { v8::HandleScope handle_scope(node_isolate); return CallDelegate(v8::False(), - handle(), + const_cast(this)->handle(), "isCommandIdChecked", command_id)->BooleanValue(); } @@ -62,7 +62,7 @@ bool Menu::IsCommandIdChecked(int command_id) const { bool Menu::IsCommandIdEnabled(int command_id) const { v8::HandleScope handle_scope(node_isolate); return CallDelegate(v8::True(), - handle(), + const_cast(this)->handle(), "isCommandIdEnabled", command_id)->BooleanValue(); } @@ -70,7 +70,7 @@ bool Menu::IsCommandIdEnabled(int command_id) const { bool Menu::IsCommandIdVisible(int command_id) const { v8::HandleScope handle_scope(node_isolate); return CallDelegate(v8::True(), - handle(), + const_cast(this)->handle(), "isCommandIdVisible", command_id)->BooleanValue(); } @@ -93,7 +93,7 @@ bool Menu::GetAcceleratorForCommandId(int command_id, bool Menu::IsItemForCommandIdDynamic(int command_id) const { v8::HandleScope handle_scope(node_isolate); return CallDelegate(v8::False(), - handle(), + const_cast(this)->handle(), "isItemForCommandIdDynamic", command_id)->BooleanValue(); } @@ -101,7 +101,7 @@ bool Menu::IsItemForCommandIdDynamic(int command_id) const { string16 Menu::GetLabelForCommandId(int command_id) const { v8::HandleScope handle_scope(node_isolate); return FromV8Value(CallDelegate(v8::False(), - handle(), + const_cast(this)->handle(), "getLabelForCommandId", command_id)); } @@ -109,7 +109,7 @@ string16 Menu::GetLabelForCommandId(int command_id) const { string16 Menu::GetSublabelForCommandId(int command_id) const { v8::HandleScope handle_scope(node_isolate); return FromV8Value(CallDelegate(v8::False(), - handle(), + const_cast(this)->handle(), "getSubLabelForCommandId", command_id)); }