summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_resolver.h
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 22:20:50 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 22:20:50 +0000
commit9b9ae9556a0b51fc0201e925624ae6bd76686536 (patch)
treecc0643d59f985f5c28f73e4056dac5a20bfe0e0d /net/proxy/proxy_resolver.h
parent947405b19c553f4cba8d0027f472ed932b2d84d5 (diff)
downloadchromium_src-9b9ae9556a0b51fc0201e925624ae6bd76686536.zip
chromium_src-9b9ae9556a0b51fc0201e925624ae6bd76686536.tar.gz
chromium_src-9b9ae9556a0b51fc0201e925624ae6bd76686536.tar.bz2
Optimization: reduce the copying of string data between C++ and javascript in proxy_resolver_v8.cc.
This is done by sharing the string storage using ExternalStringResource. An accompanying change was to pass around the PAC script data as a UTF16 string16 rather than a UTF8 std::string -- this required changing plumbing in the other files. This optimization will be important when creating multiple ProxyResolverV8's so they don't end up duplicating the script text. BUG=11079 Review URL: http://codereview.chromium.org/2817043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_resolver.h')
-rw-r--r--net/proxy/proxy_resolver.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/proxy/proxy_resolver.h b/net/proxy/proxy_resolver.h
index 50f855a..b200206 100644
--- a/net/proxy/proxy_resolver.h
+++ b/net/proxy/proxy_resolver.h
@@ -5,9 +5,8 @@
#ifndef NET_PROXY_PROXY_RESOLVER_H_
#define NET_PROXY_PROXY_RESOLVER_H_
-#include <string>
-
#include "base/logging.h"
+#include "base/string16.h"
#include "googleurl/src/gurl.h"
#include "net/base/completion_callback.h"
@@ -55,14 +54,14 @@ class ProxyResolver {
// Sets the PAC script backend to use for this proxy resolver (by URL).
int SetPacScriptByUrl(const GURL& url, CompletionCallback* callback) {
DCHECK(!expects_pac_bytes());
- return SetPacScript(url, std::string(), callback);
+ return SetPacScript(url, string16(), callback);
}
// Sets the PAC script backend to use for this proxy resolver (by contents).
- int SetPacScriptByData(const std::string& bytes_utf8,
+ int SetPacScriptByData(const string16& script,
CompletionCallback* callback) {
DCHECK(expects_pac_bytes());
- return SetPacScript(GURL(), bytes_utf8, callback);
+ return SetPacScript(GURL(), script, callback);
}
// TODO(eroman): Make this =0.
@@ -77,12 +76,12 @@ class ProxyResolver {
private:
// Called to set the PAC script backend to use. If |pac_url| is invalid,
- // this is a request to use WPAD (auto detect). |bytes_utf8| may be empty if
+ // this is a request to use WPAD (auto detect). |pac_script| may be empty if
// the fetch failed, or if the fetch returned no content.
// Returns ERR_IO_PENDING in the case of asynchronous completion, and notifies
// the result through |callback|.
virtual int SetPacScript(const GURL& pac_url,
- const std::string& bytes_utf8,
+ const string16& pac_script,
CompletionCallback* callback) = 0;
const bool expects_pac_bytes_;