OLD | NEW |
---|---|
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 #include "net/url_request/url_request_context_getter.h" | 5 #include "net/url_request/url_request_context_getter.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "net/url_request/url_request_context.h" | 9 #include "net/url_request/url_request_context.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 URLRequestContextGetter::URLRequestContextGetter() {} | 13 URLRequestContextGetter::URLRequestContextGetter() {} |
14 | 14 |
15 URLRequestContextGetter::~URLRequestContextGetter() {} | 15 URLRequestContextGetter::~URLRequestContextGetter() {} |
16 | 16 |
17 void URLRequestContextGetter::OnDestruct() const { | 17 void URLRequestContextGetter::OnDestruct() const { |
18 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner = | 18 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner = |
19 GetNetworkTaskRunner(); | 19 GetNetworkTaskRunner(); |
20 DCHECK(network_task_runner); | 20 DCHECK(network_task_runner); |
21 if (network_task_runner) { | 21 if (network_task_runner) { |
22 if (network_task_runner->BelongsToCurrentThread()) { | 22 if (network_task_runner->BelongsToCurrentThread()) { |
23 delete this; | 23 delete this; |
24 } else { | 24 } else { |
25 network_task_runner->DeleteSoon(FROM_HERE, this); | 25 if (!network_task_runner->DeleteSoon(FROM_HERE, this)) { |
26 // Can't force-delete the object here, because some derived classes | |
eroman
2012/08/15 18:00:44
Please change the language to not reference chrome
Andrew T Wilson (Slow)
2012/08/15 18:07:17
Ah, good point. I'll do this.
| |
27 // (like ShellURLRequestContextGetter) may only be deleted on the IO | |
28 // thread. | |
29 DLOG(WARNING) << "URLRequestContextGetter leaking due to no IO thread."; | |
eroman
2012/08/15 18:00:44
How about making this simply LOG(WARNING)?
Andrew T Wilson (Slow)
2012/08/15 18:07:17
Since this really only impacts unit tests, I figur
| |
30 } | |
26 } | 31 } |
27 } | 32 } |
28 // If no IO message loop proxy was available, we will just leak memory. | 33 // If no IO message loop proxy was available, we will just leak memory. |
29 // This is also true if the IO thread is gone. | 34 // This is also true if the IO thread is gone. |
30 } | 35 } |
31 | 36 |
32 } // namespace net | 37 } // namespace net |
OLD | NEW |