| Index: net/proxy/proxy_resolver_v8.cc
|
| ===================================================================
|
| --- net/proxy/proxy_resolver_v8.cc (revision 41560)
|
| +++ net/proxy/proxy_resolver_v8.cc (working copy)
|
| @@ -1,14 +1,14 @@
|
| -// Copyright (c) 2009 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.
|
|
|
| #include "net/proxy/proxy_resolver_v8.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/string_util.h"
|
| #include "googleurl/src/gurl.h"
|
| -#include "net/base/load_log.h"
|
| #include "net/base/net_errors.h"
|
| +#include "net/base/net_log.h"
|
| #include "net/proxy/proxy_info.h"
|
| #include "net/proxy/proxy_resolver_js_bindings.h"
|
| #include "net/proxy/proxy_resolver_script.h"
|
| @@ -102,7 +102,7 @@
|
| class ProxyResolverV8::Context {
|
| public:
|
| explicit Context(ProxyResolverJSBindings* js_bindings)
|
| - : js_bindings_(js_bindings), current_request_load_log_(NULL) {
|
| + : js_bindings_(js_bindings), current_request_net_log_(NULL) {
|
| DCHECK(js_bindings != NULL);
|
| }
|
|
|
| @@ -214,8 +214,8 @@
|
| return OK;
|
| }
|
|
|
| - void SetCurrentRequestLoadLog(LoadLog* load_log) {
|
| - current_request_load_log_ = load_log;
|
| + void SetCurrentRequestNetLog(BoundNetLog* net_log) {
|
| + current_request_net_log_ = net_log;
|
| }
|
|
|
| void PurgeMemory() {
|
| @@ -293,15 +293,15 @@
|
| Context* context =
|
| static_cast<Context*>(v8::External::Cast(*args.Data())->Value());
|
|
|
| - LoadLog::BeginEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS);
|
| + context->current_request_net_log_->BeginEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS);
|
|
|
| // We shouldn't be called with any arguments, but will not complain if
|
| // we are.
|
| std::string result = context->js_bindings_->MyIpAddress();
|
|
|
| - LoadLog::EndEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS);
|
| + context->current_request_net_log_->EndEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS);
|
|
|
| if (result.empty())
|
| result = "127.0.0.1";
|
| @@ -314,15 +314,15 @@
|
| Context* context =
|
| static_cast<Context*>(v8::External::Cast(*args.Data())->Value());
|
|
|
| - LoadLog::BeginEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX);
|
| + context->current_request_net_log_->BeginEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX);
|
|
|
| // We shouldn't be called with any arguments, but will not complain if
|
| // we are.
|
| std::string result = context->js_bindings_->MyIpAddressEx();
|
|
|
| - LoadLog::EndEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX);
|
| + context->current_request_net_log_->EndEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_MY_IP_ADDRESS_EX);
|
|
|
| return StdStringToV8String(result);
|
| }
|
| @@ -341,13 +341,13 @@
|
| return v8::Undefined();
|
| }
|
|
|
| - LoadLog::BeginEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE);
|
| + context->current_request_net_log_->BeginEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE);
|
|
|
| std::string result = context->js_bindings_->DnsResolve(host);
|
|
|
| - LoadLog::EndEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE);
|
| + context->current_request_net_log_->EndEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE);
|
|
|
| // DnsResolve() returns empty string on failure.
|
| return result.empty() ? v8::Null() : StdStringToV8String(result);
|
| @@ -367,19 +367,19 @@
|
| return v8::Undefined();
|
| }
|
|
|
| - LoadLog::BeginEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX);
|
| + context->current_request_net_log_->BeginEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX);
|
|
|
| std::string result = context->js_bindings_->DnsResolveEx(host);
|
|
|
| - LoadLog::EndEvent(context->current_request_load_log_,
|
| - LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX);
|
| + context->current_request_net_log_->EndEvent(
|
| + NetLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE_EX);
|
|
|
| return StdStringToV8String(result);
|
| }
|
|
|
| ProxyResolverJSBindings* js_bindings_;
|
| - LoadLog* current_request_load_log_;
|
| + BoundNetLog* current_request_net_log_;
|
| v8::Persistent<v8::External> v8_this_;
|
| v8::Persistent<v8::Context> v8_context_;
|
| };
|
| @@ -398,16 +398,18 @@
|
| ProxyInfo* results,
|
| CompletionCallback* /*callback*/,
|
| RequestHandle* /*request*/,
|
| - LoadLog* load_log) {
|
| + const BoundNetLog& net_log) {
|
| // If the V8 instance has not been initialized (either because
|
| // SetPacScript() wasn't called yet, or because it failed.
|
| if (!context_.get())
|
| return ERR_FAILED;
|
|
|
| + BoundNetLog log(net_log);
|
| +
|
| // Otherwise call into V8.
|
| - context_->SetCurrentRequestLoadLog(load_log);
|
| + context_->SetCurrentRequestNetLog(&log);
|
| int rv = context_->ResolveProxy(query_url, results);
|
| - context_->SetCurrentRequestLoadLog(NULL);
|
| + context_->SetCurrentRequestNetLog(NULL);
|
|
|
| return rv;
|
| }
|
|
|