summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 18:23:05 +0000
committerpeter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 18:23:05 +0000
commita8030a22c88436615550267e26b539382dd5fe8b (patch)
treed25b01d04058e18309329edef8cfb1d059690429
parent26ca33d393dbd3d3b8763d1659f906f52d2e0289 (diff)
downloadchromium_src-a8030a22c88436615550267e26b539382dd5fe8b.zip
chromium_src-a8030a22c88436615550267e26b539382dd5fe8b.tar.gz
chromium_src-a8030a22c88436615550267e26b539382dd5fe8b.tar.bz2
Revert 256579 "Allow the content browser client to specify a spe..."
This broke the Android builders. The try-bots on the CL did point out the compile errors, but it was committed manually anyway. Logs: http://build.chromium.org/p/chromium.linux/builders/Android%20Clang%20Builder%20%28dbg%29/builds/30977/steps/compile/logs/stdio > Allow the content browser client to specify a special cookie store to be > used for a given render process id. This special cookie store will then > be used for renderer messages pertaining to cookies, url fetches in net, > and websockets. If the special cookie store is NULL, a default cookie store > will be used. > > R=erikwright@chromium.org, jam@chromium.org, lambroslambrou@chromium.org, mmenke@chromium.org, tyoshino@chromium.org > > Review URL: https://codereview.chromium.org/188693003 TBR=tburkard@chromium.org Review URL: https://codereview.chromium.org/197463003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256583 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/net/chrome_fraudulent_certificate_reporter.cc2
-rw-r--r--chrome/browser/net/connection_tester.cc2
-rw-r--r--chrome/browser/net/http_pipelining_compatibility_client.cc3
-rw-r--r--chrome/browser/plugins/plugin_installer.cc2
-rw-r--r--chrome/browser/ssl/ssl_client_certificate_selector_test.cc2
-rw-r--r--chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc2
-rw-r--r--content/browser/download/download_manager_impl.cc2
-rw-r--r--content/browser/fileapi/blob_url_request_job_unittest.cc2
-rw-r--r--content/browser/fileapi/file_system_dir_url_request_job_unittest.cc2
-rw-r--r--content/browser/fileapi/file_system_url_request_job_unittest.cc2
-rw-r--r--content/browser/fileapi/file_writer_delegate_unittest.cc4
-rw-r--r--content/browser/loader/resource_dispatcher_host_impl.cc12
-rw-r--r--content/browser/loader/resource_scheduler_unittest.cc2
-rw-r--r--content/browser/renderer_host/render_message_filter.cc53
-rw-r--r--content/browser/renderer_host/render_message_filter.h5
-rw-r--r--content/browser/renderer_host/socket_stream_dispatcher_host.cc3
-rw-r--r--content/browser/renderer_host/socket_stream_host.cc11
-rw-r--r--content/browser/renderer_host/socket_stream_host.h2
-rw-r--r--content/browser/streams/stream_url_request_job_unittest.cc4
-rw-r--r--content/public/browser/content_browser_client.cc5
-rw-r--r--content/public/browser/content_browser_client.h7
-rw-r--r--net/proxy/proxy_script_fetcher_impl.cc2
-rw-r--r--net/socket_stream/socket_stream.cc56
-rw-r--r--net/socket_stream/socket_stream.h15
-rw-r--r--net/socket_stream/socket_stream_job.cc12
-rw-r--r--net/socket_stream/socket_stream_job.h16
-rw-r--r--net/socket_stream/socket_stream_job_manager.cc10
-rw-r--r--net/socket_stream/socket_stream_job_manager.h3
-rw-r--r--net/socket_stream/socket_stream_unittest.cc81
-rw-r--r--net/url_request/url_fetcher_core.cc2
-rw-r--r--net/url_request/url_request.cc82
-rw-r--r--net/url_request/url_request.h24
-rw-r--r--net/url_request/url_request_context.cc6
-rw-r--r--net/url_request/url_request_context.h6
-rw-r--r--net/url_request/url_request_http_job.cc9
-rw-r--r--net/url_request/url_request_job.cc6
-rw-r--r--net/url_request/url_request_job.h4
-rw-r--r--net/websockets/websocket_job.cc13
-rw-r--r--net/websockets/websocket_job_test.cc15
-rw-r--r--net/websockets/websocket_throttle_test.cc27
-rw-r--r--remoting/host/token_validator_factory_impl.cc2
-rw-r--r--webkit/browser/appcache/appcache_storage_impl_unittest.cc2
-rw-r--r--webkit/browser/appcache/appcache_update_job.cc4
-rw-r--r--webkit/browser/appcache/appcache_url_request_job_unittest.cc12
-rw-r--r--webkit/browser/blob/blob_url_request_job_factory.cc2
45 files changed, 204 insertions, 336 deletions
diff --git a/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc b/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc
index efea4b5..505e54f 100644
--- a/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc
+++ b/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc
@@ -60,7 +60,7 @@ scoped_ptr<net::URLRequest>
ChromeFraudulentCertificateReporter::CreateURLRequest(
net::URLRequestContext* context) {
scoped_ptr<net::URLRequest> request =
- context->CreateRequest(upload_url_, net::DEFAULT_PRIORITY, this, NULL);
+ context->CreateRequest(upload_url_, net::DEFAULT_PRIORITY, this);
request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
net::LOAD_DO_NOT_SAVE_COOKIES);
return request.Pass();
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 5672d45..eca301c 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -412,7 +412,7 @@ void ConnectionTester::TestRunner::ProxyConfigServiceCreated(
}
// Fetch a request using the experimental context.
request_ = request_context_->CreateRequest(
- experiment.url, net::DEFAULT_PRIORITY, this, NULL);
+ experiment.url, net::DEFAULT_PRIORITY, this);
request_->Start();
}
diff --git a/chrome/browser/net/http_pipelining_compatibility_client.cc b/chrome/browser/net/http_pipelining_compatibility_client.cc
index 3f2ee54..407211b 100644
--- a/chrome/browser/net/http_pipelining_compatibility_client.cc
+++ b/chrome/browser/net/http_pipelining_compatibility_client.cc
@@ -93,8 +93,7 @@ Request::Request(int request_id,
url_request_(url_request_context->CreateRequest(GURL(base_url +
info.filename),
net::DEFAULT_PRIORITY,
- this,
- NULL)),
+ this)),
info_(info),
response_code_(0) {
url_request_->SetLoadFlags(net::LOAD_BYPASS_CACHE |
diff --git a/chrome/browser/plugins/plugin_installer.cc b/chrome/browser/plugins/plugin_installer.cc
index e9322a9..76b00e3 100644
--- a/chrome/browser/plugins/plugin_installer.cc
+++ b/chrome/browser/plugins/plugin_installer.cc
@@ -47,7 +47,7 @@ void BeginDownload(
ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get();
scoped_ptr<net::URLRequest> request(
resource_context->GetRequestContext()->CreateRequest(
- url, net::DEFAULT_PRIORITY, NULL, NULL));
+ url, net::DEFAULT_PRIORITY, NULL));
content::DownloadInterruptReason error = rdh->BeginDownload(
request.Pass(),
content::Referrer(),
diff --git a/chrome/browser/ssl/ssl_client_certificate_selector_test.cc b/chrome/browser/ssl/ssl_client_certificate_selector_test.cc
index d0318c6..f0a0918 100644
--- a/chrome/browser/ssl/ssl_client_certificate_selector_test.cc
+++ b/chrome/browser/ssl/ssl_client_certificate_selector_test.cc
@@ -98,6 +98,6 @@ SSLClientCertificateSelectorTestBase::MakeURLRequest(
net::URLRequestContextGetter* context_getter) {
scoped_ptr<net::URLRequest> request =
context_getter->GetURLRequestContext()->CreateRequest(
- GURL("https://example"), net::DEFAULT_PRIORITY, NULL, NULL);
+ GURL("https://example"), net::DEFAULT_PRIORITY, NULL);
return request.Pass();
}
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
index c677b8b..3c61796 100644
--- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
+++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
@@ -113,7 +113,7 @@ class SSLClientCertificateSelectorTest : public InProcessBrowserTest {
scoped_ptr<net::URLRequest> MakeURLRequest(
net::URLRequestContextGetter* context_getter) {
return context_getter->GetURLRequestContext()->CreateRequest(
- GURL("https://example"), net::DEFAULT_PRIORITY, NULL, NULL);
+ GURL("https://example"), net::DEFAULT_PRIORITY, NULL);
}
base::WaitableEvent io_loop_finished_event_;
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 1705678..b3a461f 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -56,7 +56,7 @@ void BeginDownload(scoped_ptr<DownloadUrlParameters> params,
// we must down cast. RDHI is the only subclass of RDH as of 2012 May 4.
scoped_ptr<net::URLRequest> request(
params->resource_context()->GetRequestContext()->CreateRequest(
- params->url(), net::DEFAULT_PRIORITY, NULL, NULL));
+ params->url(), net::DEFAULT_PRIORITY, NULL));
request->SetLoadFlags(request->load_flags() | params->load_flags());
request->set_method(params->method());
if (!params->post_body().empty()) {
diff --git a/content/browser/fileapi/blob_url_request_job_unittest.cc b/content/browser/fileapi/blob_url_request_job_unittest.cc
index dd1ad1a..29c0e8f 100644
--- a/content/browser/fileapi/blob_url_request_job_unittest.cc
+++ b/content/browser/fileapi/blob_url_request_job_unittest.cc
@@ -248,7 +248,7 @@ class BlobURLRequestJobTest : public testing::Test {
void TestRequest(const std::string& method,
const net::HttpRequestHeaders& extra_headers) {
request_ = url_request_context_.CreateRequest(
- GURL("blob:blah"), net::DEFAULT_PRIORITY, &url_request_delegate_, NULL);
+ GURL("blob:blah"), net::DEFAULT_PRIORITY, &url_request_delegate_);
request_->set_method(method);
if (!extra_headers.IsEmpty())
request_->SetExtraRequestHeaders(extra_headers);
diff --git a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
index e17157f..46b4bb1 100644
--- a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
+++ b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
@@ -88,7 +88,7 @@ class FileSystemDirURLRequestJobTest : public testing::Test {
delegate_.reset(new net::TestDelegate());
delegate_->set_quit_on_redirect(true);
request_ = empty_context_.CreateRequest(
- url, net::DEFAULT_PRIORITY, delegate_.get(), NULL);
+ url, net::DEFAULT_PRIORITY, delegate_.get());
job_ = new fileapi::FileSystemDirURLRequestJob(
request_.get(), NULL, file_system_context);
diff --git a/content/browser/fileapi/file_system_url_request_job_unittest.cc b/content/browser/fileapi/file_system_url_request_job_unittest.cc
index 2ddaef6..7fe55f6 100644
--- a/content/browser/fileapi/file_system_url_request_job_unittest.cc
+++ b/content/browser/fileapi/file_system_url_request_job_unittest.cc
@@ -105,7 +105,7 @@ class FileSystemURLRequestJobTest : public testing::Test {
delegate_->set_quit_on_complete(true);
delegate_->set_quit_on_redirect(true);
request_ = empty_context_.CreateRequest(
- url, net::DEFAULT_PRIORITY, delegate_.get(), NULL);
+ url, net::DEFAULT_PRIORITY, delegate_.get());
if (headers)
request_->SetExtraRequestHeaders(*headers);
ASSERT_TRUE(!job_);
diff --git a/content/browser/fileapi/file_writer_delegate_unittest.cc b/content/browser/fileapi/file_writer_delegate_unittest.cc
index 9f1e22d..88700d2 100644
--- a/content/browser/fileapi/file_writer_delegate_unittest.cc
+++ b/content/browser/fileapi/file_writer_delegate_unittest.cc
@@ -137,7 +137,7 @@ class FileWriterDelegateTest : public PlatformTest {
file_writer_delegate_.reset(
CreateWriterDelegate(test_file_path, offset, allowed_growth));
request_ = empty_context_.CreateRequest(
- blob_url, net::DEFAULT_PRIORITY, file_writer_delegate_.get(), NULL);
+ blob_url, net::DEFAULT_PRIORITY, file_writer_delegate_.get());
}
static net::URLRequest::ProtocolFactory Factory;
@@ -334,7 +334,7 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithoutQuotaLimitConcurrent) {
// Credate another FileWriterDelegate for concurrent write.
file_writer_delegate2.reset(CreateWriterDelegate("test2", 0, kint64max));
request2 = empty_context_.CreateRequest(
- kBlobURL2, net::DEFAULT_PRIORITY, file_writer_delegate2.get(), NULL);
+ kBlobURL2, net::DEFAULT_PRIORITY, file_writer_delegate2.get());
Result result, result2;
ASSERT_EQ(0, usage());
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 0058a24..94899d5 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1056,12 +1056,9 @@ void ResourceDispatcherHostImpl::BeginRequest(
}
// Construct the request.
- net::CookieStore* cookie_store =
- GetContentClient()->browser()->OverrideCookieStoreForRenderProcess(
- child_id);
scoped_ptr<net::URLRequest> new_request;
new_request = request_context->CreateRequest(
- request_data.url, request_data.priority, NULL, cookie_store);
+ request_data.url, request_data.priority, NULL);
new_request->set_method(request_data.method);
new_request->set_first_party_for_cookies(
@@ -1362,13 +1359,8 @@ void ResourceDispatcherHostImpl::BeginSaveFile(
return;
}
- net::CookieStore* cookie_store =
- GetContentClient()->browser()->OverrideCookieStoreForRenderProcess(
- child_id);
scoped_ptr<net::URLRequest> request(
- request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL,
- cookie_store));
-
+ request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
request->set_method("GET");
SetReferrerForRequest(request.get(), referrer);
diff --git a/content/browser/loader/resource_scheduler_unittest.cc b/content/browser/loader/resource_scheduler_unittest.cc
index 2408e3a..d248b4a 100644
--- a/content/browser/loader/resource_scheduler_unittest.cc
+++ b/content/browser/loader/resource_scheduler_unittest.cc
@@ -139,7 +139,7 @@ class ResourceSchedulerTest : public testing::Test {
net::RequestPriority priority,
int route_id) {
scoped_ptr<net::URLRequest> url_request(
- context_.CreateRequest(GURL(url), priority, NULL, NULL));
+ context_.CreateRequest(GURL(url), priority, NULL));
ResourceRequestInfoImpl* info = new ResourceRequestInfoImpl(
PROCESS_TYPE_RENDERER, // process_type
kChildId, // child_id
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 0aa002b..16a305d 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -583,9 +583,9 @@ void RenderMessageFilter::OnSetCookie(int render_frame_id,
if (GetContentClient()->browser()->AllowSetCookie(
url, first_party_for_cookies, cookie, resource_context_,
render_process_id_, render_frame_id, &options)) {
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
+ net::URLRequestContext* context = GetRequestContextForURL(url);
// Pass a null callback since we don't care about when the 'set' completes.
- cookie_store->SetCookieWithOptionsAsync(
+ context->cookie_store()->SetCookieWithOptionsAsync(
url, cookie, options, net::CookieMonster::SetCookiesCallback());
}
}
@@ -607,8 +607,9 @@ void RenderMessageFilter::OnGetCookies(int render_frame_id,
base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf));
base::debug::Alias(url_buf);
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
- net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster();
+ net::URLRequestContext* context = GetRequestContextForURL(url);
+ net::CookieMonster* cookie_monster =
+ context->cookie_store()->GetCookieMonster();
cookie_monster->GetAllCookiesForURLAsync(
url, base::Bind(&RenderMessageFilter::CheckPolicyForCookies, this,
render_frame_id, url, first_party_for_cookies,
@@ -634,8 +635,9 @@ void RenderMessageFilter::OnGetRawCookies(
// We check policy here to avoid sending back cookies that would not normally
// be applied to outbound requests for the given URL. Since this cookie info
// is visible in the developer tools, it is helpful to make it match reality.
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
- net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster();
+ net::URLRequestContext* context = GetRequestContextForURL(url);
+ net::CookieMonster* cookie_monster =
+ context->cookie_store()->GetCookieMonster();
cookie_monster->GetAllCookiesForURLAsync(
url, base::Bind(&RenderMessageFilter::SendGetRawCookiesResponse,
this, reply_msg));
@@ -648,8 +650,8 @@ void RenderMessageFilter::OnDeleteCookie(const GURL& url,
if (!policy->CanAccessCookiesForOrigin(render_process_id_, url))
return;
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
- cookie_store->DeleteCookieAsync(url, cookie_name, base::Closure());
+ net::URLRequestContext* context = GetRequestContextForURL(url);
+ context->cookie_store()->DeleteCookieAsync(url, cookie_name, base::Closure());
}
void RenderMessageFilter::OnCookiesEnabled(
@@ -883,17 +885,9 @@ void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message,
const base::string16& suggested_name) {
scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
save_info->suggested_name = suggested_name;
-
- // There may be a special cookie store that we could use for this download,
- // rather than the default one. Since this feature is generally only used for
- // proper render views, and not downloads, we do not need to retrieve the
- // special cookie store here, but just initialize the request to use the
- // default cookie store.
- // TODO(tburkard): retrieve the appropriate special cookie store, if this
- // is ever to be used for downloads as well.
scoped_ptr<net::URLRequest> request(
resource_context_->GetRequestContext()->CreateRequest(
- url, net::DEFAULT_PRIORITY, NULL, NULL));
+ url, net::DEFAULT_PRIORITY, NULL));
RecordDownloadSource(INITIATED_BY_RENDERER);
resource_dispatcher_host_->BeginDownload(
request.Pass(),
@@ -926,30 +920,17 @@ void RenderMessageFilter::OnAllocateSharedMemory(
buffer_size, PeerHandle(), handle);
}
-net::CookieStore* RenderMessageFilter::GetCookieStoreForURL(
+net::URLRequestContext* RenderMessageFilter::GetRequestContextForURL(
const GURL& url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
net::URLRequestContext* context =
GetContentClient()->browser()->OverrideRequestContextForURL(
url, resource_context_);
+ if (!context)
+ context = request_context_->GetURLRequestContext();
- // If we should use a special URLRequestContext rather than the default one,
- // return the cookie store of that special URLRequestContext.
- if (context)
- return context->cookie_store();
-
- // Otherwise, if there is a special cookie store to be used for this process,
- // return that cookie store.
- net::CookieStore* cookie_store =
- GetContentClient()->browser()->OverrideCookieStoreForRenderProcess(
- render_process_id_);
- if (cookie_store)
- return cookie_store;
-
- // Otherwise, return the cookie store of the default request context used
- // for this renderer.
- return request_context_->GetURLRequestContext()->cookie_store();
+ return context;
}
#if defined(OS_POSIX) && !defined(TOOLKIT_GTK) && !defined(OS_ANDROID)
@@ -1072,14 +1053,14 @@ void RenderMessageFilter::CheckPolicyForCookies(
const GURL& first_party_for_cookies,
IPC::Message* reply_msg,
const net::CookieList& cookie_list) {
- net::CookieStore* cookie_store = GetCookieStoreForURL(url);
+ net::URLRequestContext* context = GetRequestContextForURL(url);
// Check the policy for get cookies, and pass cookie_list to the
// TabSpecificContentSetting for logging purpose.
if (GetContentClient()->browser()->AllowGetCookie(
url, first_party_for_cookies, cookie_list, resource_context_,
render_process_id_, render_frame_id)) {
// Gets the cookies from cookie store if allowed.
- cookie_store->GetCookiesWithOptionsAsync(
+ context->cookie_store()->GetCookiesWithOptionsAsync(
url, net::CookieOptions(),
base::Bind(&RenderMessageFilter::SendGetCookiesResponse,
this, reply_msg));
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index b87b962..d23d9b7 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -62,7 +62,6 @@ struct MediaLogEvent;
}
namespace net {
-class CookieStore;
class KeygenHandler;
class URLRequestContext;
class URLRequestContextGetter;
@@ -109,10 +108,10 @@ class RenderMessageFilter : public BrowserMessageFilter {
int render_process_id() const { return render_process_id_; }
- // Returns the correct net::CookieStore depending on what type of url is
+ // Returns the correct net::URLRequestContext depending on what type of url is
// given.
// Only call on the IO thread.
- net::CookieStore* GetCookieStoreForURL(const GURL& url);
+ net::URLRequestContext* GetRequestContextForURL(const GURL& url);
private:
friend class BrowserThread;
diff --git a/content/browser/renderer_host/socket_stream_dispatcher_host.cc b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
index ca622f1..5c5e2b8a 100644
--- a/content/browser/renderer_host/socket_stream_dispatcher_host.cc
+++ b/content/browser/renderer_host/socket_stream_dispatcher_host.cc
@@ -224,8 +224,7 @@ void SocketStreamDispatcherHost::OnConnect(int render_frame_id,
// Note that the SocketStreamHost is responsible for checking that |url|
// is valid.
SocketStreamHost* socket_stream_host =
- new SocketStreamHost(this, render_process_id_, render_frame_id,
- socket_id);
+ new SocketStreamHost(this, render_frame_id, socket_id);
hosts_.AddWithID(socket_stream_host, socket_id);
socket_stream_host->Connect(url, GetURLRequestContext());
DVLOG(2) << "SocketStreamDispatcherHost::OnConnect -> " << socket_id;
diff --git a/content/browser/renderer_host/socket_stream_host.cc b/content/browser/renderer_host/socket_stream_host.cc
index 364b8d0..f09f2f3 100644
--- a/content/browser/renderer_host/socket_stream_host.cc
+++ b/content/browser/renderer_host/socket_stream_host.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "content/common/socket_stream.h"
-#include "content/public/browser/content_browser_client.h"
#include "net/socket_stream/socket_stream_job.h"
#include "net/url_request/url_request_context.h"
@@ -29,11 +28,9 @@ class SocketStreamId : public net::SocketStream::UserData {
SocketStreamHost::SocketStreamHost(
net::SocketStream::Delegate* delegate,
- int child_id,
int render_frame_id,
int socket_id)
: delegate_(delegate),
- child_id_(child_id),
render_frame_id_(render_frame_id),
socket_id_(socket_id) {
DCHECK_NE(socket_id_, kNoSocketId);
@@ -54,7 +51,7 @@ int SocketStreamHost::SocketIdFromSocketStream(
SocketStreamHost::~SocketStreamHost() {
VLOG(1) << "SocketStreamHost destructed socket_id=" << socket_id_;
- job_->DetachContext();
+ job_->set_context(NULL);
job_->DetachDelegate();
}
@@ -63,10 +60,8 @@ void SocketStreamHost::Connect(const GURL& url,
VLOG(1) << "SocketStreamHost::Connect url=" << url;
job_ = net::SocketStreamJob::CreateSocketStreamJob(
url, delegate_, request_context->transport_security_state(),
- request_context->ssl_config_service(),
- request_context,
- GetContentClient()->browser()->OverrideCookieStoreForRenderProcess(
- child_id_));
+ request_context->ssl_config_service());
+ job_->set_context(request_context);
job_->SetUserData(kSocketIdKey, new SocketStreamId(socket_id_));
job_->Connect();
}
diff --git a/content/browser/renderer_host/socket_stream_host.h b/content/browser/renderer_host/socket_stream_host.h
index da4716c..eb9b719 100644
--- a/content/browser/renderer_host/socket_stream_host.h
+++ b/content/browser/renderer_host/socket_stream_host.h
@@ -29,7 +29,6 @@ namespace content {
class SocketStreamHost {
public:
SocketStreamHost(net::SocketStream::Delegate* delegate,
- int child_id,
int render_frame_id,
int socket_id);
~SocketStreamHost();
@@ -67,7 +66,6 @@ class SocketStreamHost {
private:
net::SocketStream::Delegate* delegate_;
- int child_id_;
int render_frame_id_;
int socket_id_;
diff --git a/content/browser/streams/stream_url_request_job_unittest.cc b/content/browser/streams/stream_url_request_job_unittest.cc
index 035a588..9caf684 100644
--- a/content/browser/streams/stream_url_request_job_unittest.cc
+++ b/content/browser/streams/stream_url_request_job_unittest.cc
@@ -76,7 +76,7 @@ class StreamURLRequestJobTest : public testing::Test {
const std::string& expected_response) {
net::TestDelegate delegate;
request_ = url_request_context_.CreateRequest(
- url, net::DEFAULT_PRIORITY, &delegate, NULL);
+ url, net::DEFAULT_PRIORITY, &delegate);
request_->set_method(method);
if (!extra_headers.IsEmpty())
request_->SetExtraRequestHeaders(extra_headers);
@@ -134,7 +134,7 @@ TEST_F(StreamURLRequestJobTest, TestGetLargeStreamRequest) {
TEST_F(StreamURLRequestJobTest, TestGetNonExistentStreamRequest) {
net::TestDelegate delegate;
request_ = url_request_context_.CreateRequest(
- kStreamURL, net::DEFAULT_PRIORITY, &delegate, NULL);
+ kStreamURL, net::DEFAULT_PRIORITY, &delegate);
request_->set_method("GET");
request_->Start();
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 169ca96..4d2c80b 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -310,9 +310,4 @@ bool ContentBrowserClient::IsPluginAllowedToUseDevChannelAPIs() {
return false;
}
-net::CookieStore* ContentBrowserClient::OverrideCookieStoreForRenderProcess(
- int render_process_id) {
- return NULL;
-}
-
} // namespace content
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index e3e8250..18c837b 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -50,7 +50,6 @@ class ImageSkia;
namespace net {
class CookieOptions;
-class CookieStore;
class HttpNetworkSession;
class NetLog;
class SSLCertRequestInfo;
@@ -626,12 +625,6 @@ class CONTENT_EXPORT ContentBrowserClient {
// Returns true if dev channel APIs are available for plugins.
virtual bool IsPluginAllowedToUseDevChannelAPIs();
-
- // Returns a special cookie store to use for a given render process, or NULL
- // if the default cookie store should be used
- // This is called on the IO thread.
- virtual net::CookieStore* OverrideCookieStoreForRenderProcess(
- int render_process_id_);
};
} // namespace content
diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc
index 0887d8c..705bbbf 100644
--- a/net/proxy/proxy_script_fetcher_impl.cc
+++ b/net/proxy/proxy_script_fetcher_impl.cc
@@ -135,7 +135,7 @@ int ProxyScriptFetcherImpl::Fetch(
}
cur_request_ =
- url_request_context_->CreateRequest(url, DEFAULT_PRIORITY, this, NULL);
+ url_request_context_->CreateRequest(url, DEFAULT_PRIORITY, this);
cur_request_->set_method("GET");
// Make sure that the PAC script is downloaded using a direct connection,
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 5aacd4a..1682ddc 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -87,13 +87,11 @@ void SocketStream::ResponseHeaders::Realloc(size_t new_size) {
SocketStream::ResponseHeaders::~ResponseHeaders() { data_ = NULL; }
-SocketStream::SocketStream(const GURL& url, Delegate* delegate,
- URLRequestContext* context,
- CookieStore* cookie_store)
+SocketStream::SocketStream(const GURL& url, Delegate* delegate)
: delegate_(delegate),
url_(url),
max_pending_send_allowed_(kMaxPendingSendAllowed),
- context_(context),
+ context_(NULL),
next_state_(STATE_NONE),
factory_(ClientSocketFactory::GetDefaultFactory()),
proxy_mode_(kDirectConnection),
@@ -110,24 +108,12 @@ SocketStream::SocketStream(const GURL& url, Delegate* delegate,
waiting_for_write_completion_(false),
closing_(false),
server_closed_(false),
- metrics_(new SocketStreamMetrics(url)),
- cookie_store_(cookie_store) {
+ metrics_(new SocketStreamMetrics(url)) {
DCHECK(base::MessageLoop::current())
<< "The current base::MessageLoop must exist";
DCHECK(base::MessageLoopForIO::IsCurrent())
<< "The current base::MessageLoop must be TYPE_IO";
DCHECK(delegate_);
-
- if (context_) {
- if (!cookie_store_)
- cookie_store_ = context_->cookie_store();
-
- net_log_ = BoundNetLog::Make(
- context->net_log(),
- NetLog::SOURCE_SOCKET_STREAM);
-
- net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
- }
}
SocketStream::UserData* SocketStream::GetUserData(
@@ -146,20 +132,28 @@ bool SocketStream::is_secure() const {
return url_.SchemeIs("wss");
}
-void SocketStream::DetachContext() {
- if (!context_)
- return;
+void SocketStream::set_context(URLRequestContext* context) {
+ const URLRequestContext* prev_context = context_;
- if (pac_request_) {
- context_->proxy_service()->CancelPacRequest(pac_request_);
- pac_request_ = NULL;
- }
+ context_ = context;
- net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE);
- net_log_ = BoundNetLog();
+ if (prev_context != context) {
+ if (prev_context && pac_request_) {
+ prev_context->proxy_service()->CancelPacRequest(pac_request_);
+ pac_request_ = NULL;
+ }
+
+ net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE);
+ net_log_ = BoundNetLog();
- context_ = NULL;
- cookie_store_ = NULL;
+ if (context) {
+ net_log_ = BoundNetLog::Make(
+ context->net_log(),
+ NetLog::SOURCE_SOCKET_STREAM);
+
+ net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
+ }
+ }
}
void SocketStream::CheckPrivacyMode() {
@@ -324,7 +318,7 @@ void SocketStream::ContinueDespiteError() {
}
SocketStream::~SocketStream() {
- DetachContext();
+ set_context(NULL);
DCHECK(!delegate_);
DCHECK(!pac_request_);
}
@@ -1348,8 +1342,4 @@ int SocketStream::HandleCertificateError(int result) {
return ERR_IO_PENDING;
}
-CookieStore* SocketStream::cookie_store() const {
- return cookie_store_;
-}
-
} // namespace net
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index cfc764d..b86f20a 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -19,7 +19,6 @@
#include "net/base/net_export.h"
#include "net/base/net_log.h"
#include "net/base/privacy_mode.h"
-#include "net/cookies/cookie_store.h"
#include "net/proxy/proxy_service.h"
#include "net/ssl/ssl_config_service.h"
#include "net/url_request/url_request.h"
@@ -115,8 +114,7 @@ class NET_EXPORT SocketStream
virtual ~Delegate() {}
};
- SocketStream(const GURL& url, Delegate* delegate, URLRequestContext* context,
- CookieStore* cookie_store);
+ SocketStream(const GURL& url, Delegate* delegate);
// The user data allows the clients to associate data with this job.
// Multiple user data values can be stored under different keys.
@@ -132,6 +130,9 @@ class NET_EXPORT SocketStream
int max_pending_send_allowed() const { return max_pending_send_allowed_; }
URLRequestContext* context() { return context_; }
+ // There're some asynchronous operations and members that are constructed from
+ // |context|. Be careful when you use this for the second time or more.
+ void set_context(URLRequestContext* context);
const SSLConfig& server_ssl_config() const { return server_ssl_config_; }
PrivacyMode privacy_mode() const { return privacy_mode_; }
@@ -161,9 +162,6 @@ class NET_EXPORT SocketStream
// back.
virtual void DetachDelegate();
- // Detach the context.
- virtual void DetachContext();
-
const ProxyServer& proxy_server() const;
// Sets an alternative ClientSocketFactory. Doesn't take ownership of
@@ -182,8 +180,6 @@ class NET_EXPORT SocketStream
// actions on alert dialog or browser cached such kinds of user actions.
void ContinueDespiteError();
- CookieStore* cookie_store() const;
-
protected:
friend class base::RefCountedThreadSafe<SocketStream>;
virtual ~SocketStream();
@@ -393,9 +389,6 @@ class NET_EXPORT SocketStream
scoped_ptr<SocketStreamMetrics> metrics_;
- // Cookie store to use for this socket stream.
- scoped_refptr<CookieStore> cookie_store_;
-
DISALLOW_COPY_AND_ASSIGN(SocketStream);
};
diff --git a/net/socket_stream/socket_stream_job.cc b/net/socket_stream/socket_stream_job.cc
index f2de823..9c13a8f 100644
--- a/net/socket_stream/socket_stream_job.cc
+++ b/net/socket_stream/socket_stream_job.cc
@@ -24,9 +24,7 @@ SocketStreamJob* SocketStreamJob::CreateSocketStreamJob(
const GURL& url,
SocketStream::Delegate* delegate,
TransportSecurityState* sts,
- SSLConfigService* ssl,
- URLRequestContext* context,
- CookieStore* cookie_store) {
+ SSLConfigService* ssl) {
GURL socket_url(url);
TransportSecurityState::DomainState domain_state;
if (url.scheme() == "ws" && sts && sts->GetDomainState(
@@ -38,8 +36,7 @@ SocketStreamJob* SocketStreamJob::CreateSocketStreamJob(
url_parse::Component(0, strlen(kNewScheme)));
socket_url = url.ReplaceComponents(replacements);
}
- return SocketStreamJobManager::GetInstance()->CreateJob(
- socket_url, delegate, context, cookie_store);
+ return SocketStreamJobManager::GetInstance()->CreateJob(socket_url, delegate);
}
SocketStreamJob::SocketStreamJob() {}
@@ -85,11 +82,6 @@ void SocketStreamJob::DetachDelegate() {
socket_->DetachDelegate();
}
-void SocketStreamJob::DetachContext() {
- if (socket_.get())
- socket_->DetachContext();
-}
-
SocketStreamJob::~SocketStreamJob() {}
} // namespace net
diff --git a/net/socket_stream/socket_stream_job.h b/net/socket_stream/socket_stream_job.h
index 9fc27d9..d12e73a 100644
--- a/net/socket_stream/socket_stream_job.h
+++ b/net/socket_stream/socket_stream_job.h
@@ -15,7 +15,6 @@ class GURL;
namespace net {
-class CookieStore;
class SSLConfigService;
class SSLInfo;
class TransportSecurityState;
@@ -31,9 +30,7 @@ class NET_EXPORT SocketStreamJob
public:
// Callback function implemented by protocol handlers to create new jobs.
typedef SocketStreamJob* (ProtocolFactory)(const GURL& url,
- SocketStream::Delegate* delegate,
- URLRequestContext* context,
- CookieStore* cookie_store);
+ SocketStream::Delegate* delegate);
static ProtocolFactory* RegisterProtocolFactory(const std::string& scheme,
ProtocolFactory* factory);
@@ -42,9 +39,7 @@ class NET_EXPORT SocketStreamJob
const GURL& url,
SocketStream::Delegate* delegate,
TransportSecurityState* sts,
- SSLConfigService* ssl,
- URLRequestContext* context,
- CookieStore* cookie_store);
+ SSLConfigService* ssl);
SocketStreamJob();
void InitSocketStream(SocketStream* socket) {
@@ -57,8 +52,9 @@ class NET_EXPORT SocketStreamJob
URLRequestContext* context() const {
return socket_.get() ? socket_->context() : 0;
}
- CookieStore* cookie_store() const {
- return socket_.get() ? socket_->cookie_store() : 0;
+ void set_context(URLRequestContext* context) {
+ if (socket_.get())
+ socket_->set_context(context);
}
virtual void Connect();
@@ -77,8 +73,6 @@ class NET_EXPORT SocketStreamJob
virtual void DetachDelegate();
- virtual void DetachContext();
-
protected:
friend class WebSocketJobTest;
friend class base::RefCountedThreadSafe<SocketStreamJob>;
diff --git a/net/socket_stream/socket_stream_job_manager.cc b/net/socket_stream/socket_stream_job_manager.cc
index 6418be4..7f66a4a 100644
--- a/net/socket_stream/socket_stream_job_manager.cc
+++ b/net/socket_stream/socket_stream_job_manager.cc
@@ -20,14 +20,12 @@ SocketStreamJobManager* SocketStreamJobManager::GetInstance() {
}
SocketStreamJob* SocketStreamJobManager::CreateJob(
- const GURL& url, SocketStream::Delegate* delegate,
- URLRequestContext* context, CookieStore* cookie_store) const {
+ const GURL& url, SocketStream::Delegate* delegate) const {
// If url is invalid, create plain SocketStreamJob, which will close
// the socket immediately.
if (!url.is_valid()) {
SocketStreamJob* job = new SocketStreamJob();
- job->InitSocketStream(new SocketStream(url, delegate, context,
- cookie_store));
+ job->InitSocketStream(new SocketStream(url, delegate));
return job;
}
@@ -36,12 +34,12 @@ SocketStreamJob* SocketStreamJobManager::CreateJob(
base::AutoLock locked(lock_);
FactoryMap::const_iterator found = factories_.find(scheme);
if (found != factories_.end()) {
- SocketStreamJob* job = found->second(url, delegate, context, cookie_store);
+ SocketStreamJob* job = found->second(url, delegate);
if (job)
return job;
}
SocketStreamJob* job = new SocketStreamJob();
- job->InitSocketStream(new SocketStream(url, delegate, context, cookie_store));
+ job->InitSocketStream(new SocketStream(url, delegate));
return job;
}
diff --git a/net/socket_stream/socket_stream_job_manager.h b/net/socket_stream/socket_stream_job_manager.h
index 2363fb5..aa0cd40 100644
--- a/net/socket_stream/socket_stream_job_manager.h
+++ b/net/socket_stream/socket_stream_job_manager.h
@@ -22,8 +22,7 @@ class SocketStreamJobManager {
static SocketStreamJobManager* GetInstance();
SocketStreamJob* CreateJob(
- const GURL& url, SocketStream::Delegate* delegate,
- URLRequestContext* context, CookieStore* cookie_store) const;
+ const GURL& url, SocketStream::Delegate* delegate) const;
SocketStreamJob::ProtocolFactory* RegisterProtocolFactory(
const std::string& scheme, SocketStreamJob::ProtocolFactory* factory);
diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc
index 069f92e..4a6a9e2 100644
--- a/net/socket_stream/socket_stream_unittest.cc
+++ b/net/socket_stream/socket_stream_unittest.cc
@@ -318,7 +318,7 @@ class SocketStreamTest : public PlatformTest {
virtual void DoCloseFlushPendingWriteTestWithSetContextNull(
SocketStreamEvent* event) {
- event->socket->DetachContext();
+ event->socket->set_context(NULL);
// handshake response received.
for (size_t i = 0; i < messages_.size(); i++) {
std::vector<char> frame;
@@ -400,8 +400,9 @@ TEST_F(SocketStreamTest, CloseFlushPendingWrite) {
TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
+ socket_stream->set_context(&context);
MockWrite data_writes[] = {
MockWrite(SocketStreamTest::kWebSocketHandshakeRequest),
@@ -452,16 +453,16 @@ TEST_F(SocketStreamTest, ResolveFailure) {
scoped_ptr<SocketStreamEventRecorder> delegate(
new SocketStreamEventRecorder(test_callback.callback()));
+ scoped_refptr<SocketStream> socket_stream(
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
// Make resolver fail.
TestURLRequestContext context;
scoped_ptr<MockHostResolver> mock_host_resolver(
new MockHostResolver());
mock_host_resolver->rules()->AddSimulatedFailure("example.com");
context.set_host_resolver(mock_host_resolver.get());
-
- scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ socket_stream->set_context(&context);
// No read/write on socket is expected.
StaticSocketDataProvider data_provider(NULL, 0, NULL, 0);
@@ -492,8 +493,9 @@ TEST_F(SocketStreamTest, ExceedMaxPendingSendAllowed) {
TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
+ socket_stream->set_context(&context);
DelayedSocketData data_provider(1, NULL, 0, NULL, 0);
@@ -564,12 +566,12 @@ TEST_F(SocketStreamTest, BasicAuthProxy) {
&SocketStreamEventRecorder::DoRestartWithAuth,
base::Unretained(delegate.get())));
- TestURLRequestContextWithProxy context("myproxy:70");
-
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
+ TestURLRequestContextWithProxy context("myproxy:70");
+ socket_stream->set_context(&context);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
socket_stream->Connect();
@@ -616,6 +618,9 @@ TEST_F(SocketStreamTest, BasicAuthProxyWithAuthCache) {
delegate->SetOnConnected(base::Bind(&SocketStreamEventRecorder::DoClose,
base::Unretained(delegate.get())));
+ scoped_refptr<SocketStream> socket_stream(
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
TestURLRequestContextWithProxy context("myproxy:70");
HttpAuthCache* auth_cache =
context.http_transaction_factory()->GetSession()->http_auth_cache();
@@ -627,10 +632,7 @@ TEST_F(SocketStreamTest, BasicAuthProxyWithAuthCache) {
ASCIIToUTF16("bar")),
"/");
- scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
-
+ socket_stream->set_context(&context);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
socket_stream->Connect();
@@ -673,6 +675,9 @@ TEST_F(SocketStreamTest, WSSBasicAuthProxyWithAuthCache) {
delegate->SetOnConnected(base::Bind(&SocketStreamEventRecorder::DoClose,
base::Unretained(delegate.get())));
+ scoped_refptr<SocketStream> socket_stream(
+ new SocketStream(GURL("wss://example.com/demo"), delegate.get()));
+
TestURLRequestContextWithProxy context("myproxy:70");
HttpAuthCache* auth_cache =
context.http_transaction_factory()->GetSession()->http_auth_cache();
@@ -684,10 +689,7 @@ TEST_F(SocketStreamTest, WSSBasicAuthProxyWithAuthCache) {
ASCIIToUTF16("bar")),
"/");
- scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("wss://example.com/demo"), delegate.get(),
- &context, NULL));
-
+ socket_stream->set_context(&context);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
socket_stream->Connect();
@@ -719,8 +721,9 @@ TEST_F(SocketStreamTest, IOPending) {
TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
+ socket_stream->set_context(&context);
MockWrite data_writes[] = {
MockWrite(SocketStreamTest::kWebSocketHandshakeRequest),
@@ -780,8 +783,9 @@ TEST_F(SocketStreamTest, SwitchToSpdy) {
TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
+ socket_stream->set_context(&context);
socket_stream->Connect();
@@ -807,8 +811,9 @@ TEST_F(SocketStreamTest, SwitchAfterPending) {
TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
+ socket_stream->set_context(&context);
socket_stream->Connect();
io_test_callback_.WaitForResult();
@@ -860,9 +865,9 @@ TEST_F(SocketStreamTest, SecureProxyConnectError) {
base::Unretained(delegate.get())));
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+ socket_stream->set_context(&context);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
socket_stream->Connect();
@@ -911,9 +916,9 @@ TEST_F(SocketStreamTest, SecureProxyConnect) {
base::Unretained(delegate.get())));
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+ socket_stream->set_context(&context);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
socket_stream->Connect();
@@ -943,8 +948,9 @@ TEST_F(SocketStreamTest, BeforeConnectFailed) {
context.set_network_delegate(&network_delegate);
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
+
+ socket_stream->set_context(&context);
socket_stream->Connect();
@@ -975,8 +981,8 @@ TEST_F(SocketStreamTest, OnErrorDetachDelegate) {
TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://localhost:9998/echo"), delegate,
- &context, NULL));
+ new SocketStream(GURL("ws://localhost:9998/echo"), delegate));
+ socket_stream->set_context(&context);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
delegate->set_socket_stream(socket_stream);
// The delegate pointer will become invalid during the test. Set it to NULL to
@@ -995,8 +1001,7 @@ TEST_F(SocketStreamTest, NullContextSocketStreamShouldNotCrash) {
new SocketStreamEventRecorder(test_callback.callback()));
TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
- new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
- &context, NULL));
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
delegate->SetOnStartOpenConnection(base::Bind(
&SocketStreamTest::DoIOPending, base::Unretained(this)));
delegate->SetOnConnected(base::Bind(
@@ -1005,6 +1010,8 @@ TEST_F(SocketStreamTest, NullContextSocketStreamShouldNotCrash) {
&SocketStreamTest::DoCloseFlushPendingWriteTestWithSetContextNull,
base::Unretained(this)));
+ socket_stream->set_context(&context);
+
MockWrite data_writes[] = {
MockWrite(SocketStreamTest::kWebSocketHandshakeRequest),
};
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index eb45ecf..eea2e81 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -507,7 +507,7 @@ void URLFetcherCore::StartURLRequest() {
g_registry.Get().AddURLFetcherCore(this);
current_response_bytes_ = 0;
request_ = request_context_getter_->GetURLRequestContext()->CreateRequest(
- original_url_, DEFAULT_PRIORITY, this, NULL);
+ original_url_, DEFAULT_PRIORITY, this);
request_->set_stack_trace(stack_trace_);
int flags = request_->load_flags() | load_flags_;
if (!g_interception_enabled)
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index e2be4c2..531e8e8 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -209,17 +209,38 @@ URLRequest::URLRequest(const GURL& url,
RequestPriority priority,
Delegate* delegate,
const URLRequestContext* context)
- : identifier_(GenerateURLRequestIdentifier()) {
- Init(url, priority, delegate, context, NULL);
-}
+ : context_(context),
+ network_delegate_(context->network_delegate()),
+ net_log_(BoundNetLog::Make(context->net_log(),
+ NetLog::SOURCE_URL_REQUEST)),
+ url_chain_(1, url),
+ method_("GET"),
+ referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
+ load_flags_(LOAD_NORMAL),
+ delegate_(delegate),
+ is_pending_(false),
+ is_redirecting_(false),
+ redirect_limit_(kMaxRedirects),
+ priority_(priority),
+ identifier_(GenerateURLRequestIdentifier()),
+ calling_delegate_(false),
+ use_blocked_by_as_load_param_(false),
+ before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
+ base::Unretained(this))),
+ has_notified_completion_(false),
+ received_response_content_length_(0),
+ creation_time_(base::TimeTicks::Now()),
+ notified_before_network_start_(false) {
+ SIMPLE_STATS_COUNTER("URLRequestCount");
-URLRequest::URLRequest(const GURL& url,
- RequestPriority priority,
- Delegate* delegate,
- const URLRequestContext* context,
- CookieStore* cookie_store)
- : identifier_(GenerateURLRequestIdentifier()) {
- Init(url, priority, delegate, context, cookie_store);
+ // Sanity check out environment.
+ DCHECK(base::MessageLoop::current())
+ << "The current base::MessageLoop must exist";
+
+ CHECK(context);
+ context->url_requests()->insert(this);
+
+ net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
}
URLRequest::~URLRequest() {
@@ -263,47 +284,6 @@ void URLRequest::UnregisterRequestInterceptor(Interceptor* interceptor) {
interceptor);
}
-void URLRequest::Init(const GURL& url,
- RequestPriority priority,
- Delegate* delegate,
- const URLRequestContext* context,
- CookieStore* cookie_store) {
- context_ = context;
- network_delegate_ = context->network_delegate();
- net_log_ = BoundNetLog::Make(context->net_log(), NetLog::SOURCE_URL_REQUEST);
- url_chain_.push_back(url);
- method_ = "GET";
- referrer_policy_ = CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
- load_flags_ = LOAD_NORMAL;
- delegate_ = delegate;
- is_pending_ = false;
- is_redirecting_ = false;
- redirect_limit_ = kMaxRedirects;
- priority_ = priority;
- calling_delegate_ = false;
- use_blocked_by_as_load_param_ =false;
- before_request_callback_ = base::Bind(&URLRequest::BeforeRequestComplete,
- base::Unretained(this));
- has_notified_completion_ = false;
- received_response_content_length_ = 0;
- creation_time_ = base::TimeTicks::Now();
- notified_before_network_start_ = false;
-
- SIMPLE_STATS_COUNTER("URLRequestCount");
-
- // Sanity check out environment.
- DCHECK(base::MessageLoop::current())
- << "The current base::MessageLoop must exist";
-
- CHECK(context);
- context->url_requests()->insert(this);
- cookie_store_ = cookie_store;
- if (cookie_store_ == NULL)
- cookie_store_ = context->cookie_store();
-
- net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
-}
-
void URLRequest::EnableChunkedUpload() {
DCHECK(!upload_data_stream_ || upload_data_stream_->is_chunked());
if (!upload_data_stream_) {
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index f4e8c40..7c8e1a9 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -25,7 +25,6 @@
#include "net/base/request_priority.h"
#include "net/base/upload_progress.h"
#include "net/cookies/canonical_cookie.h"
-#include "net/cookies/cookie_store.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_info.h"
#include "net/url_request/url_request_status.h"
@@ -292,20 +291,11 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
virtual ~Delegate() {}
};
- // TODO(tburkard): we should get rid of this constructor, and have each
- // creator of a URLRequest specifically list the cookie store to be used.
- // For now, this constructor will use the cookie store in |context|.
URLRequest(const GURL& url,
RequestPriority priority,
Delegate* delegate,
const URLRequestContext* context);
- URLRequest(const GURL& url,
- RequestPriority priority,
- Delegate* delegate,
- const URLRequestContext* context,
- CookieStore* cookie_store);
-
// If destroyed after Start() has been called but while IO is pending,
// then the request will be effectively canceled and the delegate
// will not have any more of its methods called.
@@ -701,8 +691,6 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
// Allow the URLRequestJob class to set our status too
void set_status(const URLRequestStatus& value) { status_ = value; }
- CookieStore* cookie_store() const { return cookie_store_; }
-
// Allow the URLRequestJob to redirect this request. Returns OK if
// successful, otherwise an error code is returned.
int Redirect(const GURL& location, int http_status_code);
@@ -742,15 +730,6 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
static void RegisterRequestInterceptor(Interceptor* interceptor);
static void UnregisterRequestInterceptor(Interceptor* interceptor);
- // Initializes the URLRequest. Code shared between the two constructors.
- // TODO(tburkard): This can ultimately be folded into a single constructor
- // again.
- void Init(const GURL& url,
- RequestPriority priotity,
- Delegate* delegate,
- const URLRequestContext* context,
- CookieStore* cookie_store);
-
// Resumes or blocks a request paused by the NetworkDelegate::OnBeforeRequest
// handler. If |blocked| is true, the request is blocked and an error page is
// returned indicating so. This should only be called after Start is called
@@ -916,9 +895,6 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
// Keeps track of whether or not OnBeforeNetworkStart has been called yet.
bool notified_before_network_start_;
- // The cookie store to be used for this request.
- scoped_refptr<CookieStore> cookie_store_;
-
DISALLOW_COPY_AND_ASSIGN(URLRequest);
};
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
index d6a4d2f..3542b16 100644
--- a/net/url_request/url_request_context.cc
+++ b/net/url_request/url_request_context.cc
@@ -73,10 +73,8 @@ const HttpNetworkSession::Params* URLRequestContext::GetNetworkSessionParams(
scoped_ptr<URLRequest> URLRequestContext::CreateRequest(
const GURL& url,
RequestPriority priority,
- URLRequest::Delegate* delegate,
- CookieStore* cookie_store) const {
- return scoped_ptr<URLRequest>(
- new URLRequest(url, priority, delegate, this, cookie_store));
+ URLRequest::Delegate* delegate) const {
+ return scoped_ptr<URLRequest>(new URLRequest(url, priority, delegate, this));
}
void URLRequestContext::set_cookie_store(CookieStore* cookie_store) {
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index a05c9ae..5bb5b51 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -58,13 +58,9 @@ class NET_EXPORT URLRequestContext
// May return NULL if this context doesn't have an associated network session.
const HttpNetworkSession::Params* GetNetworkSessionParams() const;
- // Creates a URLRequest. |cookie_store| optionally specifies a cookie store
- // to be used rather than the one represented by the context, or NULL
- // otherwise.
scoped_ptr<URLRequest> CreateRequest(const GURL& url,
RequestPriority priority,
- URLRequest::Delegate* delegate,
- CookieStore* cookie_store) const;
+ URLRequest::Delegate* delegate) const;
NetLog* net_log() const {
return net_log_;
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 044e5f0..82ef633 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -539,7 +539,7 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() {
if (!request_)
return;
- CookieStore* cookie_store = GetCookieStore();
+ CookieStore* cookie_store = request_->context()->cookie_store();
if (cookie_store && !(request_info_.load_flags & LOAD_DO_NOT_SEND_COOKIES)) {
net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster();
if (cookie_monster) {
@@ -558,7 +558,7 @@ void URLRequestHttpJob::AddCookieHeaderAndStart() {
void URLRequestHttpJob::DoLoadCookies() {
CookieOptions options;
options.set_include_httponly();
- GetCookieStore()->GetCookiesWithOptionsAsync(
+ request_->context()->cookie_store()->GetCookiesWithOptionsAsync(
request_->url(), options,
base::Bind(&URLRequestHttpJob::OnCookiesLoaded,
weak_factory_.GetWeakPtr()));
@@ -638,7 +638,8 @@ void URLRequestHttpJob::SaveNextCookie() {
new SharedBoolean(true);
if (!(request_info_.load_flags & LOAD_DO_NOT_SAVE_COOKIES) &&
- GetCookieStore() && response_cookies_.size() > 0) {
+ request_->context()->cookie_store() &&
+ response_cookies_.size() > 0) {
CookieOptions options;
options.set_include_httponly();
options.set_server_time(response_date_);
@@ -656,7 +657,7 @@ void URLRequestHttpJob::SaveNextCookie() {
if (CanSetCookie(
response_cookies_[response_cookies_save_index_], &options)) {
callback_pending->data = true;
- GetCookieStore()->SetCookieWithOptionsAsync(
+ request_->context()->cookie_store()->SetCookieWithOptionsAsync(
request_->url(), response_cookies_[response_cookies_save_index_],
options, callback);
}
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index c4b34c2..78f704a 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -286,12 +286,6 @@ bool URLRequestJob::CanEnablePrivacyMode() const {
return request_->CanEnablePrivacyMode();
}
-CookieStore* URLRequestJob::GetCookieStore() const {
- DCHECK(request_);
-
- return request_->cookie_store();
-}
-
void URLRequestJob::NotifyBeforeNetworkStart(bool* defer) {
if (!request_)
return;
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index 9bb763e..3194ef6 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -26,7 +26,6 @@ namespace net {
class AuthChallengeInfo;
class AuthCredentials;
class CookieOptions;
-class CookieStore;
class Filter;
class HttpRequestHeaders;
class HttpResponseInfo;
@@ -239,9 +238,6 @@ class NET_EXPORT URLRequestJob
// Delegates to URLRequest::Delegate.
bool CanEnablePrivacyMode() const;
- // Returns the cookie store to be used for the request.
- CookieStore* GetCookieStore() const;
-
// Notifies the job that the network is about to be used.
void NotifyBeforeNetworkStart(bool* defer);
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc
index 63e65a4..b0f5be8 100644
--- a/net/websockets/websocket_job.cc
+++ b/net/websockets/websocket_job.cc
@@ -36,10 +36,9 @@ const char* const kSetCookieHeaders[] = {
};
net::SocketStreamJob* WebSocketJobFactory(
- const GURL& url, net::SocketStream::Delegate* delegate,
- net::URLRequestContext* context, net::CookieStore* cookie_store) {
+ const GURL& url, net::SocketStream::Delegate* delegate) {
net::WebSocketJob* job = new net::WebSocketJob(delegate);
- job->InitSocketStream(new net::SocketStream(url, job, context, cookie_store));
+ job->InitSocketStream(new net::SocketStream(url, job));
return job;
}
@@ -371,11 +370,11 @@ void WebSocketJob::AddCookieHeaderAndSend() {
if (socket_.get() && delegate_ && state_ == CONNECTING) {
handshake_request_->RemoveHeaders(kCookieHeaders,
arraysize(kCookieHeaders));
- if (allow && socket_->cookie_store()) {
+ if (allow && socket_->context()->cookie_store()) {
// Add cookies, including HttpOnly cookies.
CookieOptions cookie_options;
cookie_options.set_include_httponly();
- socket_->cookie_store()->GetCookiesWithOptionsAsync(
+ socket_->context()->cookie_store()->GetCookiesWithOptionsAsync(
GetURLForCookies(), cookie_options,
base::Bind(&WebSocketJob::LoadCookieCallback,
weak_ptr_factory_.GetWeakPtr()));
@@ -506,7 +505,7 @@ void WebSocketJob::SaveNextCookie() {
callback_pending_ = false;
save_next_cookie_running_ = true;
- if (socket_->cookie_store()) {
+ if (socket_->context()->cookie_store()) {
GURL url_for_cookies = GetURLForCookies();
CookieOptions options;
@@ -527,7 +526,7 @@ void WebSocketJob::SaveNextCookie() {
continue;
callback_pending_ = true;
- socket_->cookie_store()->SetCookieWithOptionsAsync(
+ socket_->context()->cookie_store()->SetCookieWithOptionsAsync(
url_for_cookies, cookie, options,
base::Bind(&WebSocketJob::OnCookieSaved,
weak_ptr_factory_.GetWeakPtr()));
diff --git a/net/websockets/websocket_job_test.cc b/net/websockets/websocket_job_test.cc
index 3d7d424..31bd9d6 100644
--- a/net/websockets/websocket_job_test.cc
+++ b/net/websockets/websocket_job_test.cc
@@ -41,9 +41,8 @@ namespace {
class MockSocketStream : public SocketStream {
public:
- MockSocketStream(const GURL& url, SocketStream::Delegate* delegate,
- URLRequestContext* context, CookieStore* cookie_store)
- : SocketStream(url, delegate, context, cookie_store) {}
+ MockSocketStream(const GURL& url, SocketStream::Delegate* delegate)
+ : SocketStream(url, delegate) {}
virtual void Connect() OVERRIDE {}
virtual bool SendData(const char* data, int len) OVERRIDE {
@@ -365,8 +364,7 @@ class WebSocketJobTest : public PlatformTest,
websocket_ = new WebSocketJob(delegate);
if (stream_type == STREAM_MOCK_SOCKET)
- socket_ = new MockSocketStream(url, websocket_.get(), context_.get(),
- NULL);
+ socket_ = new MockSocketStream(url, websocket_.get());
if (stream_type == STREAM_SOCKET || stream_type == STREAM_SPDY_WEBSOCKET) {
if (stream_type == STREAM_SPDY_WEBSOCKET) {
@@ -382,7 +380,7 @@ class WebSocketJobTest : public PlatformTest,
host_resolver_.reset(new MockHostResolver);
context_->set_host_resolver(host_resolver_.get());
- socket_ = new SocketStream(url, websocket_.get(), context_.get(), NULL);
+ socket_ = new SocketStream(url, websocket_.get());
socket_factory_.reset(new MockClientSocketFactory);
DCHECK(data_.get());
socket_factory_->AddSocketDataProvider(data_.get());
@@ -390,6 +388,7 @@ class WebSocketJobTest : public PlatformTest,
}
websocket_->InitSocketStream(socket_.get());
+ websocket_->set_context(context_.get());
// MockHostResolver resolves all hosts to 127.0.0.1; however, when we create
// a WebSocketJob purely to block another one in a throttling test, we don't
// perform a real connect. In that case, the following address is used
@@ -739,14 +738,14 @@ void WebSocketJobTest::TestHSTSUpgrade() {
scoped_refptr<SocketStreamJob> job =
SocketStreamJob::CreateSocketStreamJob(
url, &delegate, context_->transport_security_state(),
- context_->ssl_config_service(), NULL, NULL);
+ context_->ssl_config_service());
EXPECT_TRUE(GetSocket(job.get())->is_secure());
job->DetachDelegate();
url = GURL("ws://donotupgrademe.com/");
job = SocketStreamJob::CreateSocketStreamJob(
url, &delegate, context_->transport_security_state(),
- context_->ssl_config_service(), NULL, NULL);
+ context_->ssl_config_service());
EXPECT_FALSE(GetSocket(job.get())->is_secure());
job->DetachDelegate();
}
diff --git a/net/websockets/websocket_throttle_test.cc b/net/websockets/websocket_throttle_test.cc
index 7b33883..14237b9 100644
--- a/net/websockets/websocket_throttle_test.cc
+++ b/net/websockets/websocket_throttle_test.cc
@@ -73,7 +73,8 @@ TEST_F(WebSocketThrottleTest, Throttle) {
addr.push_back(MakeAddr(1, 2, 3, 6));
scoped_refptr<WebSocketJob> w1(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s1(
- new SocketStream(GURL("ws://host1/"), w1.get(), &context, NULL));
+ new SocketStream(GURL("ws://host1/"), w1.get()));
+ s1->set_context(&context);
w1->InitSocketStream(s1.get());
WebSocketThrottleTest::MockSocketStreamConnect(s1.get(), addr);
@@ -93,7 +94,8 @@ TEST_F(WebSocketThrottleTest, Throttle) {
addr.push_back(MakeAddr(1, 2, 3, 4));
scoped_refptr<WebSocketJob> w2(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s2(
- new SocketStream(GURL("ws://host2/"), w2.get(), &context, NULL));
+ new SocketStream(GURL("ws://host2/"), w2.get()));
+ s2->set_context(&context);
w2->InitSocketStream(s2.get());
WebSocketThrottleTest::MockSocketStreamConnect(s2.get(), addr);
@@ -113,7 +115,8 @@ TEST_F(WebSocketThrottleTest, Throttle) {
addr.push_back(MakeAddr(1, 2, 3, 5));
scoped_refptr<WebSocketJob> w3(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s3(
- new SocketStream(GURL("ws://host3/"), w3.get(), &context, NULL));
+ new SocketStream(GURL("ws://host3/"), w3.get()));
+ s3->set_context(&context);
w3->InitSocketStream(s3.get());
WebSocketThrottleTest::MockSocketStreamConnect(s3.get(), addr);
@@ -133,7 +136,8 @@ TEST_F(WebSocketThrottleTest, Throttle) {
addr.push_back(MakeAddr(1, 2, 3, 6));
scoped_refptr<WebSocketJob> w4(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s4(
- new SocketStream(GURL("ws://host4/"), w4.get(), &context, NULL));
+ new SocketStream(GURL("ws://host4/"), w4.get()));
+ s4->set_context(&context);
w4->InitSocketStream(s4.get());
WebSocketThrottleTest::MockSocketStreamConnect(s4.get(), addr);
@@ -152,7 +156,8 @@ TEST_F(WebSocketThrottleTest, Throttle) {
addr.push_back(MakeAddr(1, 2, 3, 6));
scoped_refptr<WebSocketJob> w5(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s5(
- new SocketStream(GURL("ws://host5/"), w5.get(), &context, NULL));
+ new SocketStream(GURL("ws://host5/"), w5.get()));
+ s5->set_context(&context);
w5->InitSocketStream(s5.get());
WebSocketThrottleTest::MockSocketStreamConnect(s5.get(), addr);
@@ -171,7 +176,8 @@ TEST_F(WebSocketThrottleTest, Throttle) {
addr.push_back(MakeAddr(1, 2, 3, 6));
scoped_refptr<WebSocketJob> w6(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s6(
- new SocketStream(GURL("ws://host6/"), w6.get(), &context, NULL));
+ new SocketStream(GURL("ws://host6/"), w6.get()));
+ s6->set_context(&context);
w6->InitSocketStream(s6.get());
WebSocketThrottleTest::MockSocketStreamConnect(s6.get(), addr);
@@ -283,7 +289,8 @@ TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) {
addr.push_back(MakeAddr(127, 0, 0, 1));
scoped_refptr<WebSocketJob> w1(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s1(
- new SocketStream(GURL("ws://localhost/"), w1.get(), &context, NULL));
+ new SocketStream(GURL("ws://localhost/"), w1.get()));
+ s1->set_context(&context);
w1->InitSocketStream(s1.get());
WebSocketThrottleTest::MockSocketStreamConnect(s1.get(), addr);
@@ -311,7 +318,8 @@ TEST_F(WebSocketThrottleTest, NoThrottleForDistinctPort) {
// socket1: 127.0.0.1:80
scoped_refptr<WebSocketJob> w1(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s1(
- new SocketStream(GURL("ws://localhost:80/"), w1.get(), &context, NULL));
+ new SocketStream(GURL("ws://localhost:80/"), w1.get()));
+ s1->set_context(&context);
w1->InitSocketStream(s1.get());
MockSocketStreamConnect(s1.get(),
AddressList::CreateFromIPAddress(localhost, 80));
@@ -324,7 +332,8 @@ TEST_F(WebSocketThrottleTest, NoThrottleForDistinctPort) {
// socket2: 127.0.0.1:81
scoped_refptr<WebSocketJob> w2(new WebSocketJob(&delegate));
scoped_refptr<SocketStream> s2(
- new SocketStream(GURL("ws://localhost:81/"), w2.get(), &context, NULL));
+ new SocketStream(GURL("ws://localhost:81/"), w2.get()));
+ s2->set_context(&context);
w2->InitSocketStream(s2.get());
MockSocketStreamConnect(s2.get(),
AddressList::CreateFromIPAddress(localhost, 81));
diff --git a/remoting/host/token_validator_factory_impl.cc b/remoting/host/token_validator_factory_impl.cc
index 0d7906a..9468d58 100644
--- a/remoting/host/token_validator_factory_impl.cc
+++ b/remoting/host/token_validator_factory_impl.cc
@@ -82,7 +82,7 @@ void TokenValidatorImpl::StartValidateRequest(const std::string& token) {
request_ = request_context_getter_->GetURLRequestContext()->CreateRequest(
third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY,
- this, NULL);
+ this);
request_->SetExtraRequestHeaderByName(
net::HttpRequestHeaders::kContentType,
"application/x-www-form-urlencoded", true);
diff --git a/webkit/browser/appcache/appcache_storage_impl_unittest.cc b/webkit/browser/appcache/appcache_storage_impl_unittest.cc
index 8a4d5d7..7eba545 100644
--- a/webkit/browser/appcache/appcache_storage_impl_unittest.cc
+++ b/webkit/browser/appcache/appcache_storage_impl_unittest.cc
@@ -1746,7 +1746,7 @@ class AppCacheStorageImplTest : public testing::Test {
AppCacheHost* host2 = backend_->GetHost(2);
GURL manifest_url = MockHttpServer::GetMockUrl("manifest");
request_ = service()->request_context()->CreateRequest(
- manifest_url, net::DEFAULT_PRIORITY, NULL, NULL);
+ manifest_url, net::DEFAULT_PRIORITY, NULL);
AppCacheInterceptor::SetExtraRequestInfo(
request_.get(), service_.get(),
backend_->process_id(), host2->host_id(),
diff --git a/webkit/browser/appcache/appcache_update_job.cc b/webkit/browser/appcache/appcache_update_job.cc
index 253aee7..03bb909 100644
--- a/webkit/browser/appcache/appcache_update_job.cc
+++ b/webkit/browser/appcache/appcache_update_job.cc
@@ -112,7 +112,7 @@ AppCacheUpdateJob::URLFetcher::URLFetcher(const GURL& url,
retry_503_attempts_(0),
buffer_(new net::IOBuffer(kBufferSize)),
request_(job->service_->request_context()
- ->CreateRequest(url, net::DEFAULT_PRIORITY, this, NULL)),
+ ->CreateRequest(url, net::DEFAULT_PRIORITY, this)),
result_(UPDATE_OK) {}
AppCacheUpdateJob::URLFetcher::~URLFetcher() {
@@ -314,7 +314,7 @@ bool AppCacheUpdateJob::URLFetcher::MaybeRetryRequest() {
++retry_503_attempts_;
result_ = UPDATE_OK;
request_ = job_->service_->request_context()->CreateRequest(
- url_, net::DEFAULT_PRIORITY, this, NULL);
+ url_, net::DEFAULT_PRIORITY, this);
Start();
return true;
}
diff --git a/webkit/browser/appcache/appcache_url_request_job_unittest.cc b/webkit/browser/appcache/appcache_url_request_job_unittest.cc
index a6e6027..3f9675a 100644
--- a/webkit/browser/appcache/appcache_url_request_job_unittest.cc
+++ b/webkit/browser/appcache/appcache_url_request_job_unittest.cc
@@ -448,8 +448,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
AppCacheStorage* storage = service_->storage();
request_ = empty_context_.CreateRequest(GURL("http://blah/"),
net::DEFAULT_PRIORITY,
- url_request_delegate_.get(),
- NULL);
+ url_request_delegate_.get());
// Setup to create an AppCacheURLRequestJob with orders to deliver
// a network response.
@@ -484,8 +483,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
AppCacheStorage* storage = service_->storage();
request_ = empty_context_.CreateRequest(GURL("http://blah/"),
net::DEFAULT_PRIORITY,
- url_request_delegate_.get(),
- NULL);
+ url_request_delegate_.get());
// Setup to create an AppCacheURLRequestJob with orders to deliver
// a network response.
@@ -535,8 +533,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
AppCacheStorage* storage = service_->storage();
request_ = empty_context_.CreateRequest(GURL("http://blah/"),
net::DEFAULT_PRIORITY,
- url_request_delegate_.get(),
- NULL);
+ url_request_delegate_.get());
// Setup to create an AppCacheURLRequestJob with orders to deliver
// a network response.
@@ -650,8 +647,7 @@ class AppCacheURLRequestJobTest : public testing::Test {
AppCacheStorage* storage = service_->storage();
request_ = empty_context_.CreateRequest(GURL("http://blah/"),
net::DEFAULT_PRIORITY,
- url_request_delegate_.get(),
- NULL);
+ url_request_delegate_.get());
// Request a range, the 3 middle chars out of 'Hello'
net::HttpRequestHeaders extra_headers;
diff --git a/webkit/browser/blob/blob_url_request_job_factory.cc b/webkit/browser/blob/blob_url_request_job_factory.cc
index 73efe4c..f36e0a5 100644
--- a/webkit/browser/blob/blob_url_request_job_factory.cc
+++ b/webkit/browser/blob/blob_url_request_job_factory.cc
@@ -35,7 +35,7 @@ scoped_ptr<net::URLRequest> BlobProtocolHandler::CreateBlobRequest(
net::URLRequest::Delegate* request_delegate) {
const GURL kBlobUrl("blob://see_user_data/");
scoped_ptr<net::URLRequest> request = request_context->CreateRequest(
- kBlobUrl, net::DEFAULT_PRIORITY, request_delegate, NULL);
+ kBlobUrl, net::DEFAULT_PRIORITY, request_delegate);
SetRequestedBlobDataHandle(request.get(), blob_data_handle.Pass());
return request.Pass();
}