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

Unified Diff: chrome/browser/extensions/extension_bookmarks_module.cc

Issue 377036: Fix memory leak in AsyncExtensionFunction. (Closed)
Patch Set: feedback Created 11 years, 1 month 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
Index: chrome/browser/extensions/extension_bookmarks_module.cc
diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc
index ee5257c0abb429fccb67ee17261e9ac1ed5bef61..fb9bc478ea071f31729386b413c109a59530e706 100644
--- a/chrome/browser/extensions/extension_bookmarks_module.cc
+++ b/chrome/browser/extensions/extension_bookmarks_module.cc
@@ -277,7 +277,7 @@ bool GetBookmarksFunction::RunImpl() {
BookmarkModel* model = profile()->GetBookmarkModel();
scoped_ptr<ListValue> json(new ListValue());
if (args_->IsType(Value::TYPE_LIST)) {
- ListValue* ids = static_cast<ListValue*>(args_);
+ const ListValue* ids = args_as_list();
size_t count = ids->GetSize();
EXTENSION_FUNCTION_VALIDATE(count > 0);
for (size_t i = 0; i < count; ++i) {
@@ -379,7 +379,7 @@ bool RemoveBookmarkFunction::RunImpl() {
return ExtensionBookmarks::RemoveNode(model, id, recursive, &error_);
} else {
EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST));
- ListValue* ids = static_cast<ListValue*>(args_);
+ const ListValue* ids = args_as_list();
size_t count = ids->GetSize();
EXTENSION_FUNCTION_VALIDATE(count > 0);
for (size_t i = 0; i < count; ++i) {
@@ -395,7 +395,7 @@ bool RemoveBookmarkFunction::RunImpl() {
bool CreateBookmarkFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_DICTIONARY));
- DictionaryValue* json = static_cast<DictionaryValue*>(args_);
+ const DictionaryValue* json = args_as_dictionary();
BookmarkModel* model = profile()->GetBookmarkModel();
int64 parentId;
@@ -459,7 +459,7 @@ bool CreateBookmarkFunction::RunImpl() {
bool MoveBookmarkFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST));
- const ListValue* args = static_cast<const ListValue*>(args_);
+ const ListValue* args = args_as_list();
int64 id;
std::string id_string;
EXTENSION_FUNCTION_VALIDATE(args->GetString(0, &id_string));
@@ -527,7 +527,7 @@ bool MoveBookmarkFunction::RunImpl() {
bool UpdateBookmarkFunction::RunImpl() {
EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST));
- const ListValue* args = static_cast<const ListValue*>(args_);
+ const ListValue* args = args_as_list();
int64 id;
std::string id_string;
EXTENSION_FUNCTION_VALIDATE(args->GetString(0, &id_string));
« no previous file with comments | « chrome/browser/extensions/execute_code_in_tab_function.cc ('k') | chrome/browser/extensions/extension_browser_actions_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698