From 32dda3615ecec2a9f0ce3318658588b4103d997d Mon Sep 17 00:00:00 2001 From: "mpcomplete@google.com" Date: Fri, 5 Jun 2009 19:07:01 +0000 Subject: Make AsyncExtensionFunction possible. Change the bookmarks API to be async functions, so that they can delay their response until the bookmark system is loaded. BUG=12353 TEST=none Review URL: http://codereview.chromium.org/114079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17751 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/extension_function.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'chrome/browser/extensions/extension_function.cc') diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc index a846d96..26adefb 100644 --- a/chrome/browser/extensions/extension_function.cc +++ b/chrome/browser/extensions/extension_function.cc @@ -33,17 +33,21 @@ const std::string AsyncExtensionFunction::GetResult() { } void AsyncExtensionFunction::SendResponse(bool success) { + if (!dispatcher()) + return; if (bad_message_) { - dispatcher_->HandleBadMessage(this); + dispatcher()->HandleBadMessage(this); } else { - dispatcher_->SendResponse(this, success); + dispatcher()->SendResponse(this, success); } } std::string AsyncExtensionFunction::extension_id() { - return dispatcher_->extension_id(); + DCHECK(dispatcher()); + return dispatcher()->extension_id(); } Profile* AsyncExtensionFunction::profile() { - return dispatcher_->profile(); + DCHECK(dispatcher()); + return dispatcher()->profile(); } -- cgit v1.1