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

Side by Side Diff: net/socket/client_socket_handle.cc

Issue 155150: CHECK to make sure connection_group is never empty. (Closed)
Patch Set: Add comments. Created 11 years, 5 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_network_transaction.cc ('k') | no next file » | 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 #include "net/socket/client_socket_handle.h" 5 #include "net/socket/client_socket_handle.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/socket/client_socket.h" 10 #include "net/socket/client_socket.h"
11 #include "net/socket/client_socket_pool.h" 11 #include "net/socket/client_socket_pool.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 ClientSocketHandle::ClientSocketHandle(ClientSocketPool* pool) 15 ClientSocketHandle::ClientSocketHandle(ClientSocketPool* pool)
16 : pool_(pool), 16 : pool_(pool),
17 socket_(NULL), 17 socket_(NULL),
18 is_reused_(false), 18 is_reused_(false),
19 ALLOW_THIS_IN_INITIALIZER_LIST( 19 ALLOW_THIS_IN_INITIALIZER_LIST(
20 callback_(this, &ClientSocketHandle::OnIOComplete)) {} 20 callback_(this, &ClientSocketHandle::OnIOComplete)) {}
21 21
22 ClientSocketHandle::~ClientSocketHandle() { 22 ClientSocketHandle::~ClientSocketHandle() {
23 Reset(); 23 Reset();
24 } 24 }
25 25
26 int ClientSocketHandle::Init(const std::string& group_name, 26 int ClientSocketHandle::Init(const std::string& group_name,
27 const HostResolver::RequestInfo& resolve_info, 27 const HostResolver::RequestInfo& resolve_info,
28 int priority, 28 int priority,
29 CompletionCallback* callback) { 29 CompletionCallback* callback) {
30 CHECK(!group_name.empty());
30 ResetInternal(true); 31 ResetInternal(true);
31 group_name_ = group_name; 32 group_name_ = group_name;
32 int rv = pool_->RequestSocket( 33 int rv = pool_->RequestSocket(
33 group_name, resolve_info, priority, this, &callback_); 34 group_name, resolve_info, priority, this, &callback_);
34 if (rv == ERR_IO_PENDING) { 35 if (rv == ERR_IO_PENDING) {
35 user_callback_ = callback; 36 user_callback_ = callback;
36 } else { 37 } else {
37 HandleInitCompletion(rv); 38 HandleInitCompletion(rv);
38 } 39 }
39 return rv; 40 return rv;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 callback->Run(result); 74 callback->Run(result);
74 } 75 }
75 76
76 void ClientSocketHandle::HandleInitCompletion(int result) { 77 void ClientSocketHandle::HandleInitCompletion(int result) {
77 CHECK(ERR_IO_PENDING != result); 78 CHECK(ERR_IO_PENDING != result);
78 if (result != OK) 79 if (result != OK)
79 ResetInternal(false); // The request failed, so there's nothing to cancel. 80 ResetInternal(false); // The request failed, so there's nothing to cancel.
80 } 81 }
81 82
82 } // namespace net 83 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698