OLD | NEW |
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 "ios/crnet/crnet_environment.h" | 5 #include "ios/crnet/crnet_environment.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return getter_.get(); | 130 return getter_.get(); |
131 } | 131 } |
132 | 132 |
133 scoped_refptr<net::URLRequestContextGetter> getter_; | 133 scoped_refptr<net::URLRequestContextGetter> getter_; |
134 base::mac::ScopedBlock<RequestFilterBlock> filter_; | 134 base::mac::ScopedBlock<RequestFilterBlock> filter_; |
135 }; | 135 }; |
136 | 136 |
137 void CrNetEnvironment::PostToNetworkThread( | 137 void CrNetEnvironment::PostToNetworkThread( |
138 const tracked_objects::Location& from_here, | 138 const tracked_objects::Location& from_here, |
139 const base::Closure& task) { | 139 const base::Closure& task) { |
140 network_io_thread_->message_loop()->PostTask(from_here, task); | 140 network_io_thread_->task_runner()->PostTask(from_here, task); |
141 } | 141 } |
142 | 142 |
143 void CrNetEnvironment::PostToFileUserBlockingThread( | 143 void CrNetEnvironment::PostToFileUserBlockingThread( |
144 const tracked_objects::Location& from_here, | 144 const tracked_objects::Location& from_here, |
145 const base::Closure& task) { | 145 const base::Closure& task) { |
146 file_user_blocking_thread_->message_loop()->PostTask(from_here, task); | 146 file_user_blocking_thread_->task_runner()->PostTask(from_here, task); |
147 } | 147 } |
148 | 148 |
149 // static | 149 // static |
150 void CrNetEnvironment::Initialize() { | 150 void CrNetEnvironment::Initialize() { |
151 DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); | 151 DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); |
152 if (!g_at_exit_) | 152 if (!g_at_exit_) |
153 g_at_exit_ = new base::AtExitManager; | 153 g_at_exit_ = new base::AtExitManager; |
154 | 154 |
155 #if !BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) | 155 #if !BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) |
156 CHECK(base::i18n::InitializeICU()); | 156 CHECK(base::i18n::InitializeICU()); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 480 |
481 return user_agent_settings->GetUserAgent(); | 481 return user_agent_settings->GetUserAgent(); |
482 } | 482 } |
483 | 483 |
484 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { | 484 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { |
485 PostToNetworkThread( | 485 PostToNetworkThread( |
486 FROM_HERE, | 486 FROM_HERE, |
487 base::Bind(&net::ClearHttpCache, main_context_getter_, | 487 base::Bind(&net::ClearHttpCache, main_context_getter_, |
488 network_io_thread_->task_runner(), base::BindBlock(callback))); | 488 network_io_thread_->task_runner(), base::BindBlock(callback))); |
489 } | 489 } |
OLD | NEW |