| 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/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // If no IO task runner was available, we will just leak memory. | 50 // If no IO task runner was available, we will just leak memory. |
| 51 // This is also true if the IO thread is gone. | 51 // This is also true if the IO thread is gone. |
| 52 } | 52 } |
| 53 | 53 |
| 54 void URLRequestContextGetter::NotifyContextShuttingDown() { | 54 void URLRequestContextGetter::NotifyContextShuttingDown() { |
| 55 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 55 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 56 | 56 |
| 57 // Once shutdown starts, this must always return NULL. | 57 // Once shutdown starts, this must always return NULL. |
| 58 DCHECK(!GetURLRequestContext()); | 58 DCHECK(!GetURLRequestContext()); |
| 59 | 59 |
| 60 FOR_EACH_OBSERVER(URLRequestContextGetterObserver, observer_list_, | 60 for (auto& observer : observer_list_) |
| 61 OnContextShuttingDown()); | 61 observer.OnContextShuttingDown(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 TrivialURLRequestContextGetter::TrivialURLRequestContextGetter( | 64 TrivialURLRequestContextGetter::TrivialURLRequestContextGetter( |
| 65 URLRequestContext* context, | 65 URLRequestContext* context, |
| 66 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner) | 66 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner) |
| 67 : context_(context), main_task_runner_(main_task_runner) { | 67 : context_(context), main_task_runner_(main_task_runner) { |
| 68 } | 68 } |
| 69 | 69 |
| 70 TrivialURLRequestContextGetter::~TrivialURLRequestContextGetter() {} | 70 TrivialURLRequestContextGetter::~TrivialURLRequestContextGetter() {} |
| 71 | 71 |
| 72 URLRequestContext* TrivialURLRequestContextGetter::GetURLRequestContext() { | 72 URLRequestContext* TrivialURLRequestContextGetter::GetURLRequestContext() { |
| 73 return context_; | 73 return context_; |
| 74 } | 74 } |
| 75 | 75 |
| 76 scoped_refptr<base::SingleThreadTaskRunner> | 76 scoped_refptr<base::SingleThreadTaskRunner> |
| 77 TrivialURLRequestContextGetter::GetNetworkTaskRunner() const { | 77 TrivialURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 78 return main_task_runner_; | 78 return main_task_runner_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 } // namespace net | 82 } // namespace net |
| OLD | NEW |