| Index: components/cronet/android/cronet_url_request_context_adapter.cc
|
| diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
|
| similarity index 83%
|
| copy from components/cronet/android/url_request_context_adapter.cc
|
| copy to components/cronet/android/cronet_url_request_context_adapter.cc
|
| index 7c99244781d467e9d641e830c58adc62c440ea5c..6867ad59a9a55ac3d87dbe92e2d58dd466e0fdb2 100644
|
| --- a/components/cronet/android/url_request_context_adapter.cc
|
| +++ b/components/cronet/android/cronet_url_request_context_adapter.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/cronet/android/url_request_context_adapter.h"
|
| +#include "components/cronet/android/cronet_url_request_context_adapter.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/files/file_util.h"
|
| @@ -112,14 +112,14 @@ class BasicNetworkDelegate : public net::NetworkDelegate {
|
|
|
| namespace cronet {
|
|
|
| -URLRequestContextAdapter::URLRequestContextAdapter(
|
| - URLRequestContextAdapterDelegate* delegate,
|
| +CronetURLRequestContextAdapter::CronetURLRequestContextAdapter(
|
| + CronetURLRequestContextAdapterDelegate* delegate,
|
| std::string user_agent) {
|
| delegate_ = delegate;
|
| user_agent_ = user_agent;
|
| }
|
|
|
| -void URLRequestContextAdapter::Initialize(
|
| +void CronetURLRequestContextAdapter::Initialize(
|
| scoped_ptr<URLRequestContextConfig> config) {
|
| network_thread_ = new base::Thread("network");
|
| base::Thread::Options options;
|
| @@ -128,12 +128,12 @@ void URLRequestContextAdapter::Initialize(
|
|
|
| GetNetworkTaskRunner()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&URLRequestContextAdapter::InitializeURLRequestContext,
|
| + base::Bind(&CronetURLRequestContextAdapter::InitializeURLRequestContext,
|
| this,
|
| Passed(&config)));
|
| }
|
|
|
| -void URLRequestContextAdapter::InitializeURLRequestContext(
|
| +void CronetURLRequestContextAdapter::InitializeURLRequestContext(
|
| scoped_ptr<URLRequestContextConfig> config) {
|
| // TODO(mmenke): Add method to have the builder enable SPDY.
|
| net::URLRequestContextBuilder context_builder;
|
| @@ -158,8 +158,7 @@ void URLRequestContextAdapter::InitializeURLRequestContext(
|
|
|
| if (quic_hint.port <= std::numeric_limits<uint16>::min() ||
|
| quic_hint.port > std::numeric_limits<uint16>::max()) {
|
| - LOG(ERROR) << "Invalid QUIC hint port: "
|
| - << quic_hint.port;
|
| + LOG(ERROR) << "Invalid QUIC hint port: " << quic_hint.port;
|
| continue;
|
| }
|
|
|
| @@ -180,30 +179,20 @@ void URLRequestContextAdapter::InitializeURLRequestContext(
|
| }
|
| }
|
|
|
| - if (VLOG_IS_ON(2)) {
|
| - net_log_observer_.reset(new NetLogObserver());
|
| - context_->net_log()->AddThreadSafeObserver(net_log_observer_.get(),
|
| - net::NetLog::LOG_ALL_BUT_BYTES);
|
| - }
|
| -
|
| delegate_->OnContextInitialized(this);
|
| }
|
|
|
| -URLRequestContextAdapter::~URLRequestContextAdapter() {
|
| - if (net_log_observer_) {
|
| - context_->net_log()->RemoveThreadSafeObserver(net_log_observer_.get());
|
| - net_log_observer_.reset();
|
| - }
|
| +CronetURLRequestContextAdapter::~CronetURLRequestContextAdapter() {
|
| StopNetLog();
|
| // TODO(mef): Ensure that |network_thread_| is destroyed properly.
|
| }
|
|
|
| -const std::string& URLRequestContextAdapter::GetUserAgent(
|
| +const std::string& CronetURLRequestContextAdapter::GetUserAgent(
|
| const GURL& url) const {
|
| return user_agent_;
|
| }
|
|
|
| -net::URLRequestContext* URLRequestContextAdapter::GetURLRequestContext() {
|
| +net::URLRequestContext* CronetURLRequestContextAdapter::GetURLRequestContext() {
|
| if (!context_) {
|
| LOG(ERROR) << "URLRequestContext is not set up";
|
| }
|
| @@ -211,11 +200,12 @@ net::URLRequestContext* URLRequestContextAdapter::GetURLRequestContext() {
|
| }
|
|
|
| scoped_refptr<base::SingleThreadTaskRunner>
|
| -URLRequestContextAdapter::GetNetworkTaskRunner() const {
|
| +CronetURLRequestContextAdapter::GetNetworkTaskRunner() const {
|
| return network_thread_->message_loop_proxy();
|
| }
|
|
|
| -void URLRequestContextAdapter::StartNetLogToFile(const std::string& file_name) {
|
| +void CronetURLRequestContextAdapter::StartNetLogToFile(
|
| + const std::string& file_name) {
|
| // Do nothing if already logging to a file.
|
| if (net_log_logger_)
|
| return;
|
| @@ -230,16 +220,10 @@ void URLRequestContextAdapter::StartNetLogToFile(const std::string& file_name) {
|
| net_log_logger_->StartObserving(context_->net_log());
|
| }
|
|
|
| -void URLRequestContextAdapter::StopNetLog() {
|
| +void CronetURLRequestContextAdapter::StopNetLog() {
|
| if (net_log_logger_) {
|
| net_log_logger_->StopObserving();
|
| net_log_logger_.reset();
|
| }
|
| }
|
| -
|
| -void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) {
|
| - VLOG(2) << "Net log entry: type=" << entry.type()
|
| - << ", source=" << entry.source().type << ", phase=" << entry.phase();
|
| -}
|
| -
|
| } // namespace cronet
|
|
|