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

Side by Side Diff: net/url_request/url_request_context_getter.cc

Issue 2702083002: Print creator's call-stack on URLRequestContextGetter leak in Debug. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « net/url_request/url_request_context_getter.h ('k') | 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 (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/debug/leak_annotations.h" 7 #include "base/debug/leak_annotations.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
(...skipping 22 matching lines...) Expand all
33 GetNetworkTaskRunner(); 33 GetNetworkTaskRunner();
34 DCHECK(network_task_runner.get()); 34 DCHECK(network_task_runner.get());
35 if (network_task_runner.get()) { 35 if (network_task_runner.get()) {
36 if (network_task_runner->BelongsToCurrentThread()) { 36 if (network_task_runner->BelongsToCurrentThread()) {
37 delete this; 37 delete this;
38 } else { 38 } else {
39 if (!network_task_runner->DeleteSoon(FROM_HERE, this)) { 39 if (!network_task_runner->DeleteSoon(FROM_HERE, this)) {
40 // Can't force-delete the object here, because some derived classes 40 // Can't force-delete the object here, because some derived classes
41 // can only be deleted on the owning thread, so just emit a warning to 41 // can only be deleted on the owning thread, so just emit a warning to
42 // aid in debugging. 42 // aid in debugging.
43 #if !defined(NDEBUG)
Ryan Sleevi 2017/02/22 19:45:57 Did you mean to remove this logging for !NDEBUG bu
Wez 2017/02/22 22:18:42 This is already a DLOG(), so compiles to a void st
43 DLOG(WARNING) << "URLRequestContextGetter leaking due to no owning" 44 DLOG(WARNING) << "URLRequestContextGetter leaking due to no owning"
44 << " thread."; 45 << " thread. Created at: " << created_at.ToString();
46 #endif // !defined(NDEBUG)
45 // Let LSan know we know this is a leak. https://crbug.com/594130 47 // Let LSan know we know this is a leak. https://crbug.com/594130
46 ANNOTATE_LEAKING_OBJECT_PTR(this); 48 ANNOTATE_LEAKING_OBJECT_PTR(this);
47 } 49 }
48 } 50 }
49 } 51 }
50 // If no IO task runner was available, we will just leak memory. 52 // If no IO task runner was available, we will just leak memory.
51 // This is also true if the IO thread is gone. 53 // This is also true if the IO thread is gone.
52 } 54 }
53 55
54 void URLRequestContextGetter::NotifyContextShuttingDown() { 56 void URLRequestContextGetter::NotifyContextShuttingDown() {
(...skipping 18 matching lines...) Expand all
73 return context_; 75 return context_;
74 } 76 }
75 77
76 scoped_refptr<base::SingleThreadTaskRunner> 78 scoped_refptr<base::SingleThreadTaskRunner>
77 TrivialURLRequestContextGetter::GetNetworkTaskRunner() const { 79 TrivialURLRequestContextGetter::GetNetworkTaskRunner() const {
78 return main_task_runner_; 80 return main_task_runner_;
79 } 81 }
80 82
81 83
82 } // namespace net 84 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_context_getter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698