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

Unified Diff: chrome/browser/extensions/api/bookmarks/bookmarks_api.cc

Issue 660513002: BookmarksFunction sending response after execution in all cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 months 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
« no previous file with comments | « chrome/browser/extensions/api/bookmarks/bookmarks_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
index 6743edad21a70b212122b41a60ae9532e52f52fb..e1fbce3b7c31c69e362af3c934d7368758772fac 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
@@ -98,14 +98,7 @@ bool BookmarksFunction::RunAsync() {
return true;
}
- bool success = RunOnReady();
- if (success) {
- content::NotificationService::current()->Notify(
- extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED,
- content::Source<const Extension>(extension()),
- content::Details<const BookmarksFunction>(this));
- }
- SendResponse(success);
+ RunAndSendResponse();
return true;
}
@@ -229,10 +222,21 @@ void BookmarksFunction::BookmarkModelChanged() {
void BookmarksFunction::BookmarkModelLoaded(BookmarkModel* model,
bool ids_reassigned) {
model->RemoveObserver(this);
- RunOnReady();
+ RunAndSendResponse();
Release(); // Balanced in RunOnReady().
}
+void BookmarksFunction::RunAndSendResponse() {
+ bool success = RunOnReady();
+ if (success) {
+ content::NotificationService::current()->Notify(
+ extensions::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED,
+ content::Source<const Extension>(extension()),
+ content::Details<const BookmarksFunction>(this));
+ }
+ SendResponse(success);
+}
+
BookmarkEventRouter::BookmarkEventRouter(Profile* profile)
: browser_context_(profile),
model_(BookmarkModelFactory::GetForProfile(profile)),
« no previous file with comments | « chrome/browser/extensions/api/bookmarks/bookmarks_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698