Index: net/proxy/proxy_resolver_v8.cc |
diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc |
index 9011875912234d2627a129b5311187ecb00d0ae9..6b476beebd00eca5e04879d3866231a16fd9dc0e 100644 |
--- a/net/proxy/proxy_resolver_v8.cc |
+++ b/net/proxy/proxy_resolver_v8.cc |
@@ -115,13 +115,9 @@ class V8ExternalASCIILiteral : public v8::String::ExternalAsciiStringResource { |
DCHECK(IsStringASCII(ascii)); |
} |
- virtual const char* data() const OVERRIDE { |
- return ascii_; |
- } |
+ virtual const char* data() const OVERRIDE { return ascii_; } |
- virtual size_t length() const OVERRIDE { |
- return length_; |
- } |
+ virtual size_t length() const OVERRIDE { return length_; } |
private: |
const char* ascii_; |
@@ -160,14 +156,15 @@ base::string16 V8StringToUTF16(v8::Handle<v8::String> s) { |
v8::Local<v8::String> ASCIIStringToV8String(v8::Isolate* isolate, |
const std::string& s) { |
DCHECK(IsStringASCII(s)); |
- return v8::String::NewFromUtf8(isolate, s.data(), v8::String::kNormalString, |
- s.size()); |
+ return v8::String::NewFromUtf8( |
+ isolate, s.data(), v8::String::kNormalString, s.size()); |
} |
// Converts a UTF16 base::string16 (warpped by a ProxyResolverScriptData) to a |
// V8 string. |
v8::Local<v8::String> ScriptDataToV8String( |
- v8::Isolate* isolate, const scoped_refptr<ProxyResolverScriptData>& s) { |
+ v8::Isolate* isolate, |
+ const scoped_refptr<ProxyResolverScriptData>& s) { |
if (s->utf16().size() * 2 <= kMaxStringBytesForCopy) { |
return v8::String::NewFromTwoByte( |
isolate, |
@@ -185,8 +182,8 @@ v8::Local<v8::String> ASCIILiteralToV8String(v8::Isolate* isolate, |
DCHECK(IsStringASCII(ascii)); |
size_t length = strlen(ascii); |
if (length <= kMaxStringBytesForCopy) |
- return v8::String::NewFromUtf8(isolate, ascii, v8::String::kNormalString, |
- length); |
+ return v8::String::NewFromUtf8( |
+ isolate, ascii, v8::String::kNormalString, length); |
return v8::String::NewExternal(isolate, |
new V8ExternalASCIILiteral(ascii, length)); |
} |
@@ -226,17 +223,16 @@ bool GetHostnameArgument(const v8::FunctionCallbackInfo<v8::Value>& args, |
// Otherwise try to convert it from IDN to punycode. |
const int kInitialBufferSize = 256; |
url::RawCanonOutputT<base::char16, kInitialBufferSize> punycode_output; |
- if (!url::IDNToASCII(hostname_utf16.data(), hostname_utf16.length(), |
- &punycode_output)) { |
+ if (!url::IDNToASCII( |
+ hostname_utf16.data(), hostname_utf16.length(), &punycode_output)) { |
return false; |
} |
// |punycode_output| should now be ASCII; convert it to a std::string. |
// (We could use UTF16ToASCII() instead, but that requires an extra string |
// copy. Since ASCII is a subset of UTF8 the following is equivalent). |
- bool success = base::UTF16ToUTF8(punycode_output.data(), |
- punycode_output.length(), |
- hostname); |
+ bool success = base::UTF16ToUTF8( |
+ punycode_output.data(), punycode_output.length(), hostname); |
DCHECK(success); |
DCHECK(IsStringASCII(*hostname)); |
return success; |
@@ -245,9 +241,7 @@ bool GetHostnameArgument(const v8::FunctionCallbackInfo<v8::Value>& args, |
// Wrapper for passing around IP address strings and IPAddressNumber objects. |
struct IPAddress { |
IPAddress(const std::string& ip_string, const IPAddressNumber& ip_number) |
- : string_value(ip_string), |
- ip_address_number(ip_number) { |
- } |
+ : string_value(ip_string), ip_address_number(ip_number) {} |
// Used for sorting IP addresses in ascending order in SortIpAddressList(). |
// IP6 addresses are placed ahead of IPv4 addresses. |
@@ -344,8 +338,7 @@ bool IsInNetEx(const std::string& ip_address, const std::string& ip_prefix) { |
class ProxyResolverV8::Context { |
public: |
Context(ProxyResolverV8* parent, v8::Isolate* isolate) |
- : parent_(parent), |
- isolate_(isolate) { |
+ : parent_(parent), isolate_(isolate) { |
DCHECK(isolate); |
} |
@@ -357,9 +350,7 @@ class ProxyResolverV8::Context { |
v8_context_.Reset(); |
} |
- JSBindings* js_bindings() { |
- return parent_->js_bindings_; |
- } |
+ JSBindings* js_bindings() { return parent_->js_bindings_; } |
int ResolveProxy(const GURL& query_url, ProxyInfo* results) { |
v8::Locker locked(isolate_); |
@@ -378,8 +369,8 @@ class ProxyResolverV8::Context { |
} |
v8::Handle<v8::Value> argv[] = { |
- ASCIIStringToV8String(isolate_, query_url.spec()), |
- ASCIIStringToV8String(isolate_, query_url.HostNoBrackets()), |
+ ASCIIStringToV8String(isolate_, query_url.spec()), |
+ ASCIIStringToV8String(isolate_, query_url.HostNoBrackets()), |
}; |
v8::TryCatch try_catch; |
@@ -405,8 +396,10 @@ class ProxyResolverV8::Context { |
// converting them to ASCII punycode. |
// crbug.com/47234 |
base::string16 error_message = |
- base::ASCIIToUTF16("FindProxyForURL() returned a non-ASCII string " |
- "(crbug.com/47234): ") + ret_str; |
+ base::ASCIIToUTF16( |
+ "FindProxyForURL() returned a non-ASCII string " |
+ "(crbug.com/47234): ") + |
+ ret_str; |
js_bindings()->OnError(-1, error_message); |
return ERR_PAC_SCRIPT_FAILED; |
} |
@@ -455,9 +448,8 @@ class ProxyResolverV8::Context { |
my_ip_address_ex_template); |
v8::Local<v8::FunctionTemplate> sort_ip_address_list_template = |
- v8::FunctionTemplate::New(isolate_, |
- &SortIpAddressListCallback, |
- v8_this); |
+ v8::FunctionTemplate::New( |
+ isolate_, &SortIpAddressListCallback, v8_this); |
global_template->Set(ASCIILiteralToV8String(isolate_, "sortIpAddressList"), |
sort_ip_address_list_template); |
@@ -466,8 +458,8 @@ class ProxyResolverV8::Context { |
global_template->Set(ASCIILiteralToV8String(isolate_, "isInNetEx"), |
is_in_net_ex_template); |
- v8_context_.Reset( |
- isolate_, v8::Context::New(isolate_, NULL, global_template)); |
+ v8_context_.Reset(isolate_, |
+ v8::Context::New(isolate_, NULL, global_template)); |
v8::Local<v8::Context> context = |
v8::Local<v8::Context>::New(isolate_, v8_context_); |
@@ -476,12 +468,10 @@ class ProxyResolverV8::Context { |
// Add the PAC utility functions to the environment. |
// (This script should never fail, as it is a string literal!) |
// Note that the two string literals are concatenated. |
- int rv = RunScript( |
- ASCIILiteralToV8String( |
- isolate_, |
- PROXY_RESOLVER_SCRIPT |
- PROXY_RESOLVER_SCRIPT_EX), |
- kPacUtilityResourceName); |
+ int rv = |
+ RunScript(ASCIILiteralToV8String( |
+ isolate_, PROXY_RESOLVER_SCRIPT PROXY_RESOLVER_SCRIPT_EX), |
+ kPacUtilityResourceName); |
if (rv != OK) { |
NOTREACHED(); |
return rv; |
@@ -509,9 +499,8 @@ class ProxyResolverV8::Context { |
bool GetFindProxyForURL(v8::Local<v8::Value>* function) { |
v8::Local<v8::Context> context = |
v8::Local<v8::Context>::New(isolate_, v8_context_); |
- *function = |
- context->Global()->Get( |
- ASCIILiteralToV8String(isolate_, "FindProxyForURL")); |
+ *function = context->Global()->Get( |
+ ASCIILiteralToV8String(isolate_, "FindProxyForURL")); |
return (*function)->IsFunction(); |
} |
@@ -618,8 +607,8 @@ class ProxyResolverV8::Context { |
{ |
v8::Unlocker unlocker(args.GetIsolate()); |
- success = context->js_bindings()->ResolveDns( |
- hostname, op, &result, &terminate); |
+ success = |
+ context->js_bindings()->ResolveDns(hostname, op, &result, &terminate); |
} |
if (terminate) |
@@ -708,17 +697,17 @@ class ProxyResolverV8::Context { |
// ProxyResolverV8 ------------------------------------------------------------ |
ProxyResolverV8::ProxyResolverV8() |
- : ProxyResolver(true /*expects_pac_bytes*/), |
- js_bindings_(NULL) { |
+ : ProxyResolver(true /*expects_pac_bytes*/), js_bindings_(NULL) { |
} |
-ProxyResolverV8::~ProxyResolverV8() {} |
+ProxyResolverV8::~ProxyResolverV8() { |
+} |
-int ProxyResolverV8::GetProxyForURL( |
- const GURL& query_url, ProxyInfo* results, |
- const CompletionCallback& /*callback*/, |
- RequestHandle* /*request*/, |
- const BoundNetLog& net_log) { |
+int ProxyResolverV8::GetProxyForURL(const GURL& query_url, |
+ ProxyInfo* results, |
+ const CompletionCallback& /*callback*/, |
+ RequestHandle* /*request*/, |
+ const BoundNetLog& net_log) { |
DCHECK(js_bindings_); |
// If the V8 instance has not been initialized (either because |