Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: mojo/services/network/network_context.cc

Issue 697883003: Store network_service cache in memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/network/network_context.h" 5 #include "mojo/services/network/network_context.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "net/proxy/proxy_service.h" 9 #include "net/proxy/proxy_service.h"
10 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
11 #include "net/url_request/url_request_context_builder.h" 11 #include "net/url_request/url_request_context_builder.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 14
15 NetworkContext::NetworkContext(const base::FilePath& base_path) { 15 NetworkContext::NetworkContext(const base::FilePath& base_path) {
16 net::URLRequestContextBuilder builder; 16 net::URLRequestContextBuilder builder;
17 builder.set_accept_language("en-us,en"); 17 builder.set_accept_language("en-us,en");
18 // TODO(darin): This is surely the wrong UA string. 18 // TODO(darin): This is surely the wrong UA string.
19 builder.set_user_agent("Mojo/0.1"); 19 builder.set_user_agent("Mojo/0.1");
20 builder.set_proxy_service(net::ProxyService::CreateDirect()); 20 builder.set_proxy_service(net::ProxyService::CreateDirect());
21 builder.set_transport_security_persister_path(base_path); 21 builder.set_transport_security_persister_path(base_path);
22 22
23 net::URLRequestContextBuilder::HttpCacheParams cache_params; 23 net::URLRequestContextBuilder::HttpCacheParams cache_params;
24 cache_params.path = base_path.Append(FILE_PATH_LITERAL("Cache")); 24 cache_params.path = base_path.Append(FILE_PATH_LITERAL("Cache"));
25 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::DISK; 25 // TODO(esprehn): For now store the cache in memory so we can run many shells
26 // in parallel when running tests, otherwise the network services in each
27 // shell will corrupt the disk cache.
28 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY;
26 builder.EnableHttpCache(cache_params); 29 builder.EnableHttpCache(cache_params);
27 30
28 builder.set_file_enabled(true); 31 builder.set_file_enabled(true);
29 32
30 url_request_context_.reset(builder.Build()); 33 url_request_context_.reset(builder.Build());
31 } 34 }
32 35
33 NetworkContext::~NetworkContext() { 36 NetworkContext::~NetworkContext() {
34 // TODO(darin): Be careful about destruction order of member variables? 37 // TODO(darin): Be careful about destruction order of member variables?
35 } 38 }
36 39
37 } // namespace mojo 40 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698