diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 22:20:50 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 22:20:50 +0000 |
commit | 9b9ae9556a0b51fc0201e925624ae6bd76686536 (patch) | |
tree | cc0643d59f985f5c28f73e4056dac5a20bfe0e0d /net/proxy/proxy_script_fetcher.h | |
parent | 947405b19c553f4cba8d0027f472ed932b2d84d5 (diff) | |
download | chromium_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_script_fetcher.h')
-rw-r--r-- | net/proxy/proxy_script_fetcher.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/net/proxy/proxy_script_fetcher.h b/net/proxy/proxy_script_fetcher.h index 09ac84e..8899cbb 100644 --- a/net/proxy/proxy_script_fetcher.h +++ b/net/proxy/proxy_script_fetcher.h @@ -1,6 +1,6 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. // ProxyScriptFetcher is an async interface for fetching a proxy auto config // script. It is specific to fetching a PAC script; enforces timeout, max-size, @@ -9,8 +9,7 @@ #ifndef NET_PROXY_PROXY_SCRIPT_FETCHER_H_ #define NET_PROXY_PROXY_SCRIPT_FETCHER_H_ -#include <string> - +#include "base/string16.h" #include "net/base/completion_callback.h" #include "testing/gtest/include/gtest/gtest_prod.h" @@ -25,8 +24,8 @@ class ProxyScriptFetcher { virtual ~ProxyScriptFetcher() {} // Downloads the given PAC URL, and invokes |callback| on completion. - // On success |callback| is executed with a result code of OK, and a - // string of the response bytes (as UTF8). On failure, the result bytes is + // On success |callback| is executed with a result code of OK, |*utf16_text| + // is filled with the response. On failure, the result text is // an empty string, and the result code is a network error. Some special // network errors that may occur are: // @@ -39,7 +38,7 @@ class ProxyScriptFetcher { // deleting |this|), then no callback is invoked. // // Only one fetch is allowed to be outstanding at a time. - virtual int Fetch(const GURL& url, std::string* utf8_bytes, + virtual int Fetch(const GURL& url, string16* utf16_text, CompletionCallback* callback) = 0; // Aborts the in-progress fetch (if any). |