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

Unified Diff: chrome/browser/web_resource/json_asynchronous_unpacker.cc

Issue 19224002: Get rid of single process code path in json_asynchronous_unpacker.cc. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: move web_resource_unpacker Created 7 years, 5 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 | « no previous file | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_resource/json_asynchronous_unpacker.cc
===================================================================
--- chrome/browser/web_resource/json_asynchronous_unpacker.cc (revision 211642)
+++ chrome/browser/web_resource/json_asynchronous_unpacker.cc (working copy)
@@ -8,9 +8,7 @@
#include "chrome/browser/web_resource/web_resource_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_utility_messages.h"
-#include "chrome/common/web_resource/web_resource_unpacker.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h"
@@ -34,29 +32,13 @@
virtual void Start(const std::string& json_data) OVERRIDE {
AddRef(); // balanced in Cleanup.
- // TODO(willchan): Look for a better signal of whether we're in a unit test
- // or not. Using |ResourceDispatcherHost::Get()| for this is pretty lame.
- // If we don't have a ResourceDispatcherHost, assume we're in a test and
- // run the unpacker directly in-process.
- bool use_utility_process =
- content::ResourceDispatcherHost::Get() &&
- !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
- if (use_utility_process) {
- BrowserThread::ID thread_id;
- CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_id));
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(
- &JSONAsynchronousUnpackerImpl::StartProcessOnIOThread,
- this, thread_id, json_data));
- } else {
- WebResourceUnpacker unpacker(json_data);
- if (unpacker.Run()) {
- OnUnpackWebResourceSucceeded(*unpacker.parsed_json());
- } else {
- OnUnpackWebResourceFailed(unpacker.error_message());
- }
- }
+ BrowserThread::ID thread_id;
+ CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_id));
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(
+ &JSONAsynchronousUnpackerImpl::StartProcessOnIOThread,
+ this, thread_id, json_data));
}
private:
« no previous file with comments | « no previous file | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698