diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-15 20:17:00 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-15 20:17:00 +0000 |
commit | 12bbc19bbbc82d0cc483f6430dfeffdbb652d6cc (patch) | |
tree | ca1f39ded8f46b6095cc48fa622f0530383b1b09 | |
parent | 89d587e39d686384574784861f0f1e4deacb327b (diff) | |
download | chromium_src-12bbc19bbbc82d0cc483f6430dfeffdbb652d6cc.zip chromium_src-12bbc19bbbc82d0cc483f6430dfeffdbb652d6cc.tar.gz chromium_src-12bbc19bbbc82d0cc483f6430dfeffdbb652d6cc.tar.bz2 |
Get rid of single process code path in json_asynchronous_unpacker.cc. Single process mode now works automatically.
Since web_resource_unpacker is only used in chrome/utility now, move it there.
BUG=19192
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/19224002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211672 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/web_resource/json_asynchronous_unpacker.cc | 32 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 2 | ||||
-rw-r--r-- | chrome/utility/chrome_content_utility_client.cc | 2 | ||||
-rw-r--r-- | chrome/utility/web_resource_unpacker.cc (renamed from chrome/common/web_resource/web_resource_unpacker.cc) | 2 | ||||
-rw-r--r-- | chrome/utility/web_resource_unpacker.h (renamed from chrome/common/web_resource/web_resource_unpacker.h) | 6 |
6 files changed, 14 insertions, 32 deletions
diff --git a/chrome/browser/web_resource/json_asynchronous_unpacker.cc b/chrome/browser/web_resource/json_asynchronous_unpacker.cc index 8eee8aa..a0f242f 100644 --- a/chrome/browser/web_resource/json_asynchronous_unpacker.cc +++ b/chrome/browser/web_resource/json_asynchronous_unpacker.cc @@ -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 @@ class JSONAsynchronousUnpackerImpl 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: diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 39f6177..fd8a886 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -304,6 +304,8 @@ 'utility/itunes_pref_parser_win.h', 'utility/profile_import_handler.cc', 'utility/profile_import_handler.h', + 'utility/web_resource_unpacker.cc', + 'utility/web_resource_unpacker.h', ], 'include_dirs': [ '..', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 18e250d8..ef36aa4 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -461,8 +461,6 @@ 'common/validation_message_messages.h', 'common/web_application_info.cc', 'common/web_application_info.h', - 'common/web_resource/web_resource_unpacker.cc', - 'common/web_resource/web_resource_unpacker.h', 'common/worker_thread_ticker.cc', 'common/worker_thread_ticker.h', '../components/nacl/common/nacl_process_type.h', diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index eab9651..c0c0488 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc @@ -17,9 +17,9 @@ #include "chrome/common/extensions/permissions/chrome_api_permissions.h" #include "chrome/common/extensions/update_manifest.h" #include "chrome/common/safe_browsing/zip_analyzer.h" -#include "chrome/common/web_resource/web_resource_unpacker.h" #include "chrome/utility/extensions/unpacker.h" #include "chrome/utility/profile_import_handler.h" +#include "chrome/utility/web_resource_unpacker.h" #include "content/public/child/image_decoder_utils.h" #include "content/public/utility/utility_thread.h" #include "printing/page_range.h" diff --git a/chrome/common/web_resource/web_resource_unpacker.cc b/chrome/utility/web_resource_unpacker.cc index f0870b2..3122200 100644 --- a/chrome/common/web_resource/web_resource_unpacker.cc +++ b/chrome/utility/web_resource_unpacker.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/web_resource/web_resource_unpacker.h" +#include "chrome/utility/web_resource_unpacker.h" #include "base/json/json_reader.h" #include "base/values.h" diff --git a/chrome/common/web_resource/web_resource_unpacker.h b/chrome/utility/web_resource_unpacker.h index 3711e33..18f045d 100644 --- a/chrome/common/web_resource/web_resource_unpacker.h +++ b/chrome/utility/web_resource_unpacker.h @@ -9,8 +9,8 @@ // it will be set up to unpack and verify image data in addition to // just parsing a JSON feed. -#ifndef CHROME_COMMON_WEB_RESOURCE_WEB_RESOURCE_UNPACKER_H_ -#define CHROME_COMMON_WEB_RESOURCE_WEB_RESOURCE_UNPACKER_H_ +#ifndef CHROME_UTILITY_WEB_RESOURCE_UNPACKER_H_ +#define CHROME_UTILITY_WEB_RESOURCE_UNPACKER_H_ #include <string> @@ -54,4 +54,4 @@ class WebResourceUnpacker { DISALLOW_COPY_AND_ASSIGN(WebResourceUnpacker); }; -#endif // CHROME_COMMON_WEB_RESOURCE_WEB_RESOURCE_UNPACKER_H_ +#endif // CHROME_UTILITY_WEB_RESOURCE_UNPACKER_H_ |