| Index: chrome/browser/extensions/webstore_install_helper.cc
|
| diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc
|
| index 37710ba393c34cddab0963799ac710f4f48aa939..2f05709ac74d3e45c3535f29787d805a9d2c8f13 100644
|
| --- a/chrome/browser/extensions/webstore_install_helper.cc
|
| +++ b/chrome/browser/extensions/webstore_install_helper.cc
|
| @@ -31,6 +31,7 @@ WebstoreInstallHelper::WebstoreInstallHelper(
|
| : delegate_(delegate),
|
| id_(id),
|
| manifest_(manifest),
|
| + started_(false),
|
| icon_url_(icon_url),
|
| context_getter_(context_getter),
|
| icon_decode_complete_(false),
|
| @@ -43,19 +44,12 @@ WebstoreInstallHelper::~WebstoreInstallHelper() {}
|
| void WebstoreInstallHelper::Start() {
|
| CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| - // No existing |json_parser_| to avoid unbalanced AddRef().
|
| - CHECK(!json_parser_.get());
|
| - AddRef(); // Balanced in OnJSONParseSucceeded()/OnJSONParseFailed().
|
| - // Use base::Unretained so that base::Bind won't AddRef() on us. Otherwise,
|
| - // we'll have two callbacks holding references to us, only one of which will
|
| - // ever be called.
|
| - json_parser_ = new safe_json::SafeJsonParser(
|
| - manifest_,
|
| - base::Bind(&WebstoreInstallHelper::OnJSONParseSucceeded,
|
| - base::Unretained(this)),
|
| - base::Bind(&WebstoreInstallHelper::OnJSONParseFailed,
|
| - base::Unretained(this)));
|
| - json_parser_->Start();
|
| + CHECK(!started_);
|
| + started_ = true;
|
| +
|
| + safe_json::SafeJsonParser::Parse(
|
| + manifest_, base::Bind(&WebstoreInstallHelper::OnJSONParseSucceeded, this),
|
| + base::Bind(&WebstoreInstallHelper::OnJSONParseFailed, this));
|
|
|
| if (icon_url_.is_empty()) {
|
| icon_decode_complete_ = true;
|
| @@ -103,7 +97,6 @@ void WebstoreInstallHelper::OnJSONParseSucceeded(
|
| parse_error_ = Delegate::MANIFEST_ERROR;
|
|
|
| ReportResultsIfComplete();
|
| - Release(); // Balanced in Start().
|
| }
|
|
|
| void WebstoreInstallHelper::OnJSONParseFailed(
|
| @@ -113,7 +106,6 @@ void WebstoreInstallHelper::OnJSONParseFailed(
|
| error_ = error_message;
|
| parse_error_ = Delegate::MANIFEST_ERROR;
|
| ReportResultsIfComplete();
|
| - Release(); // Balanced in Start().
|
| }
|
|
|
| void WebstoreInstallHelper::ReportResultsIfComplete() {
|
|
|