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

Side by Side Diff: chrome/service/gaia/service_gaia_authenticator.cc

Issue 8221021: Modify WaitableEvent::Wait() to return void (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment and style Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/service/gaia/service_gaia_authenticator.h" 5 #include "chrome/service/gaia/service_gaia_authenticator.h"
6 6
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "chrome/service/net/service_url_request_context.h" 8 #include "chrome/service/net/service_url_request_context.h"
9 #include "chrome/service/service_process.h" 9 #include "chrome/service/service_process.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 16 matching lines...) Expand all
27 unsigned long* response_code, 27 unsigned long* response_code,
28 std::string* response_body) { 28 std::string* response_body) {
29 DCHECK(url.SchemeIsSecure()); 29 DCHECK(url.SchemeIsSecure());
30 DCHECK(io_message_loop_proxy_); 30 DCHECK(io_message_loop_proxy_);
31 io_message_loop_proxy_->PostTask( 31 io_message_loop_proxy_->PostTask(
32 FROM_HERE, 32 FROM_HERE,
33 NewRunnableMethod(this, &ServiceGaiaAuthenticator::DoPost, url, 33 NewRunnableMethod(this, &ServiceGaiaAuthenticator::DoPost, url,
34 post_body)); 34 post_body));
35 // TODO(sanjeevr): Waiting here until the network request completes is not 35 // TODO(sanjeevr): Waiting here until the network request completes is not
36 // desirable. We need to change Post to be asynchronous. 36 // desirable. We need to change Post to be asynchronous.
37 if (!http_post_completed_.Wait()) // Block until network request completes. 37 // Block until network request completes. See OnURLFetchComplete.
38 NOTREACHED(); // See OnURLFetchComplete. 38 http_post_completed_.Wait();
39 39
40 *response_code = static_cast<int>(http_response_code_); 40 *response_code = static_cast<int>(http_response_code_);
41 *response_body = response_data_; 41 *response_body = response_data_;
42 return true; 42 return true;
43 } 43 }
44 44
45 // TODO(sanjeevr): This is a placeholder implementation. Need to move this logic 45 // TODO(sanjeevr): This is a placeholder implementation. Need to move this logic
46 // to a common location within the service process so that it can be resued by 46 // to a common location within the service process so that it can be resued by
47 // other classes needing a backoff delay calculation. 47 // other classes needing a backoff delay calculation.
48 int ServiceGaiaAuthenticator::GetBackoffDelaySeconds( 48 int ServiceGaiaAuthenticator::GetBackoffDelaySeconds(
(...skipping 27 matching lines...) Expand all
76 http_response_code_ = source->response_code(); 76 http_response_code_ = source->response_code();
77 response_data_ = source->GetResponseStringRef(); 77 response_data_ = source->GetResponseStringRef();
78 delete source; 78 delete source;
79 // Add an extra reference because we want http_post_completed_ to remain 79 // Add an extra reference because we want http_post_completed_ to remain
80 // valid until after Signal() returns. 80 // valid until after Signal() returns.
81 scoped_refptr<ServiceGaiaAuthenticator> keep_alive(this); 81 scoped_refptr<ServiceGaiaAuthenticator> keep_alive(this);
82 // Wake the blocked thread in Post. 82 // Wake the blocked thread in Post.
83 http_post_completed_.Signal(); 83 http_post_completed_.Signal();
84 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted! 84 // WARNING: DONT DO ANYTHING AFTER THIS CALL! |this| may be deleted!
85 } 85 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/http_bridge.cc ('k') | content/browser/in_process_webkit/indexed_db_key_utility_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698