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

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

Issue 9317074: Create an API around UtilityProcessHost and use that from chrome. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
Index: chrome/browser/extensions/extension_management_api.cc
===================================================================
--- chrome/browser/extensions/extension_management_api.cc (revision 120256)
+++ chrome/browser/extensions/extension_management_api.cc (working copy)
@@ -30,9 +30,13 @@
#include "chrome/common/extensions/url_pattern.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/browser/utility_process_host.h"
+#include "content/public/browser/utility_process_host_client.h"
using base::IntToString;
using content::BrowserThread;
+using content::UtilityProcessHost;
+using content::UtilityProcessHostClient;
namespace events = extension_event_names;
namespace keys = extension_management_api_constants;
@@ -193,13 +197,12 @@
// This class helps GetPermissionWarningsByManifestFunction manage
// sending manifest JSON strings to the utility process for parsing.
-class SafeManifestJSONParser : public UtilityProcessHost::Client {
+class SafeManifestJSONParser : public UtilityProcessHostClient {
public:
SafeManifestJSONParser(GetPermissionWarningsByManifestFunction* client,
const std::string& manifest)
: client_(client),
- manifest_(manifest),
- utility_host_(NULL) {}
+ manifest_(manifest) {}
void Start() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -211,9 +214,10 @@
void StartWorkOnIOThread() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- utility_host_ = new UtilityProcessHost(this, BrowserThread::IO);
- utility_host_->set_use_linux_zygote(true);
- utility_host_->Send(new ChromeUtilityMsg_ParseJSON(manifest_));
+ UtilityProcessHost* host =
+ UtilityProcessHost::Create(this, BrowserThread::IO);
+ host->EnableZygote();
+ host->Send(new ChromeUtilityMsg_ParseJSON(manifest_));
}
virtual bool OnMessageReceived(const IPC::Message& message) {
@@ -237,7 +241,6 @@
else
error_ = keys::kManifestParseError;
- utility_host_ = NULL; // has already deleted itself
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
@@ -247,7 +250,6 @@
void OnJSONParseFailed(const std::string& error) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
error_ = error;
- utility_host_ = NULL; // has already deleted itself
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
@@ -275,7 +277,6 @@
scoped_ptr<DictionaryValue> parsed_manifest_;
std::string error_;
- UtilityProcessHost* utility_host_;
};
} // namespace
« no previous file with comments | « chrome/browser/component_updater/component_updater_service.cc ('k') | chrome/browser/extensions/extension_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698