diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 03:40:05 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 03:40:05 +0000 |
commit | 4a74b0acc891ed67f722c4d82b94e4648e006d08 (patch) | |
tree | 6e589a510df098c3478f2726a4a0d8337b6dd64f /net | |
parent | 3bc56e26caa284999192a7100006dffd222f7189 (diff) | |
download | chromium_src-4a74b0acc891ed67f722c4d82b94e4648e006d08.zip chromium_src-4a74b0acc891ed67f722c4d82b94e4648e006d08.tar.gz chromium_src-4a74b0acc891ed67f722c4d82b94e4648e006d08.tar.bz2 |
Re-enable use of external string resources in ProxyResolverV8.
To avoid the sporadic leaks in unit tests, explicitly trigger a V8 garbage collection during teardown.
BUG=48145
Review URL: http://codereview.chromium.org/2833051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/proxy/proxy_resolver_v8.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index 25da573..5860872 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -141,8 +141,7 @@ class V8ExternalASCIIString : public v8::String::ExternalAsciiStringResource { // For small strings it is better to just make a copy, whereas for large // strings there are savings by sharing the storage. This number identifies // the cutoff length for when to start wrapping rather than creating copies. -// TODO(eroman): This is disabled because of crbug.com/48145. -const size_t kMaxStringBytesForCopy = static_cast<size_t>(-1); +const size_t kMaxStringBytesForCopy = 256; // Converts a V8 String to a UTF16 string16. string16 V8StringToUTF16(v8::Handle<v8::String> s) { @@ -246,6 +245,12 @@ class ProxyResolverV8::Context { v8_this_.Dispose(); v8_context_.Dispose(); + + // Run the V8 garbage collector. We do this to be sure the + // ExternalStringResource objects we allocated get properly disposed. + // Otherwise when running the unit-tests they may get leaked. + // See crbug.com/48145. + PurgeMemory(); } int ResolveProxy(const GURL& query_url, ProxyInfo* results) { |