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

Side by Side Diff: chrome/service/net/service_url_request_context.h

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes Created 8 years, 7 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ 5 #ifndef CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_
6 #define CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ 6 #define CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 // information for requests. This subclass is meant to be used in the service 33 // information for requests. This subclass is meant to be used in the service
34 // process where the profile is not available. 34 // process where the profile is not available.
35 // 35 //
36 class ServiceURLRequestContext : public net::URLRequestContext { 36 class ServiceURLRequestContext : public net::URLRequestContext {
37 public: 37 public:
38 // This context takes ownership of |net_proxy_config_service|. 38 // This context takes ownership of |net_proxy_config_service|.
39 explicit ServiceURLRequestContext( 39 explicit ServiceURLRequestContext(
40 const std::string& user_agent, 40 const std::string& user_agent,
41 net::ProxyConfigService* net_proxy_config_service); 41 net::ProxyConfigService* net_proxy_config_service);
42 42
43 virtual ~ServiceURLRequestContext();
44
43 // Overridden from net::URLRequestContext: 45 // Overridden from net::URLRequestContext:
44 virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; 46 virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE;
45 47
46 protected:
47 virtual ~ServiceURLRequestContext();
48
49 private: 48 private:
50 std::string user_agent_; 49 std::string user_agent_;
51 net::URLRequestContextStorage storage_; 50 net::URLRequestContextStorage storage_;
52 }; 51 };
53 52
54 class ServiceURLRequestContextGetter : public net::URLRequestContextGetter { 53 class ServiceURLRequestContextGetter : public net::URLRequestContextGetter {
55 public: 54 public:
56 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; 55 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
57 virtual scoped_refptr<base::MessageLoopProxy> 56 virtual scoped_refptr<base::MessageLoopProxy>
58 GetIOMessageLoopProxy() const OVERRIDE; 57 GetIOMessageLoopProxy() const OVERRIDE;
59 58
60 void set_user_agent(const std::string& ua) { 59 void set_user_agent(const std::string& ua) {
61 user_agent_ = ua; 60 user_agent_ = ua;
62 } 61 }
63 std::string user_agent() const { 62 std::string user_agent() const {
64 return user_agent_; 63 return user_agent_;
65 } 64 }
66 65
67 private: 66 private:
68 friend class ServiceProcess; 67 friend class ServiceProcess;
69 ServiceURLRequestContextGetter(); 68 ServiceURLRequestContextGetter();
70 virtual ~ServiceURLRequestContextGetter(); 69 virtual ~ServiceURLRequestContextGetter();
71 70
72 std::string user_agent_; 71 std::string user_agent_;
73 scoped_refptr<net::URLRequestContext> url_request_context_; 72 scoped_ptr<net::URLRequestContext> url_request_context_;
74 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 73 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
75 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 74 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
eroman 2012/05/04 04:27:02 I expect the proxy_config_service_ should outlive
76 }; 75 };
77 76
78 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_ 77 #endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698