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

Side by Side Diff: net/proxy/mock_proxy_script_fetcher.cc

Issue 1398973003: Don't use base::MessageLoop::{Quit,QuitClosure} in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/http/http_transaction_test_util.cc ('k') | net/proxy/proxy_resolver_v8_tracing_unittest.cc » ('j') | 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/proxy/mock_proxy_script_fetcher.h" 5 #include "net/proxy/mock_proxy_script_fetcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 12 matching lines...) Expand all
23 int MockProxyScriptFetcher::Fetch(const GURL& url, base::string16* text, 23 int MockProxyScriptFetcher::Fetch(const GURL& url, base::string16* text,
24 const CompletionCallback& callback) { 24 const CompletionCallback& callback) {
25 DCHECK(!has_pending_request()); 25 DCHECK(!has_pending_request());
26 26
27 // Save the caller's information, and have them wait. 27 // Save the caller's information, and have them wait.
28 pending_request_url_ = url; 28 pending_request_url_ = url;
29 pending_request_callback_ = callback; 29 pending_request_callback_ = callback;
30 pending_request_text_ = text; 30 pending_request_text_ = text;
31 31
32 if (waiting_for_fetch_) 32 if (waiting_for_fetch_)
33 base::MessageLoop::current()->Quit(); 33 base::MessageLoop::current()->QuitWhenIdle();
34 34
35 return ERR_IO_PENDING; 35 return ERR_IO_PENDING;
36 } 36 }
37 37
38 void MockProxyScriptFetcher::NotifyFetchCompletion( 38 void MockProxyScriptFetcher::NotifyFetchCompletion(
39 int result, const std::string& ascii_text) { 39 int result, const std::string& ascii_text) {
40 DCHECK(has_pending_request()); 40 DCHECK(has_pending_request());
41 *pending_request_text_ = base::ASCIIToUTF16(ascii_text); 41 *pending_request_text_ = base::ASCIIToUTF16(ascii_text);
42 CompletionCallback callback = pending_request_callback_; 42 CompletionCallback callback = pending_request_callback_;
43 pending_request_callback_.Reset(); 43 pending_request_callback_.Reset();
(...skipping 16 matching lines...) Expand all
60 } 60 }
61 61
62 void MockProxyScriptFetcher::WaitUntilFetch() { 62 void MockProxyScriptFetcher::WaitUntilFetch() {
63 DCHECK(!has_pending_request()); 63 DCHECK(!has_pending_request());
64 waiting_for_fetch_ = true; 64 waiting_for_fetch_ = true;
65 base::MessageLoop::current()->Run(); 65 base::MessageLoop::current()->Run();
66 waiting_for_fetch_ = false; 66 waiting_for_fetch_ = false;
67 } 67 }
68 68
69 } // namespace net 69 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_transaction_test_util.cc ('k') | net/proxy/proxy_resolver_v8_tracing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698