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

Side by Side Diff: net/base/test_completion_callback.h

Issue 113517: Revert "Revert "Revert "Add connected socket function to ClientSocketPool and ClientSocketHandle.""" (Closed)
Patch Set: Created 11 years, 7 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/base/client_socket_pool_unittest.cc ('k') | net/http/http_network_layer.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef NET_BASE_TEST_COMPLETION_CALLBACK_H_ 5 #ifndef NET_BASE_TEST_COMPLETION_CALLBACK_H_
6 #define NET_BASE_TEST_COMPLETION_CALLBACK_H_ 6 #define NET_BASE_TEST_COMPLETION_CALLBACK_H_
7 7
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 10
(...skipping 20 matching lines...) Expand all
31 DCHECK(!waiting_for_result_); 31 DCHECK(!waiting_for_result_);
32 while (!have_result_) { 32 while (!have_result_) {
33 waiting_for_result_ = true; 33 waiting_for_result_ = true;
34 MessageLoop::current()->Run(); 34 MessageLoop::current()->Run();
35 waiting_for_result_ = false; 35 waiting_for_result_ = false;
36 } 36 }
37 have_result_ = false; // auto-reset for next callback 37 have_result_ = false; // auto-reset for next callback
38 return result_; 38 return result_;
39 } 39 }
40 40
41 private:
41 virtual void RunWithParams(const Tuple1<int>& params) { 42 virtual void RunWithParams(const Tuple1<int>& params) {
42 result_ = params.a; 43 result_ = params.a;
43 have_result_ = true; 44 have_result_ = true;
44 if (waiting_for_result_) 45 if (waiting_for_result_)
45 MessageLoop::current()->Quit(); 46 MessageLoop::current()->Quit();
46 } 47 }
47 48
48 private:
49 int result_; 49 int result_;
50 bool have_result_; 50 bool have_result_;
51 bool waiting_for_result_; 51 bool waiting_for_result_;
52 }; 52 };
53 53
54 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_ 54 #endif // NET_BASE_TEST_COMPLETION_CALLBACK_H_
OLDNEW
« no previous file with comments | « net/base/client_socket_pool_unittest.cc ('k') | net/http/http_network_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698