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

Side by Side Diff: google_apis/gcm/base/socket_stream.cc

Issue 686963002: Switching profiler instrumentations from ScopedProfile to ScopedTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « google_apis/gaia/oauth2_token_service.cc ('k') | net/base/file_stream_context.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "google_apis/gcm/base/socket_stream.h" 5 #include "google_apis/gcm/base/socket_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/profiler/scoped_profile.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/socket/stream_socket.h" 11 #include "net/socket/stream_socket.h"
12 12
13 namespace gcm { 13 namespace gcm {
14 14
15 namespace { 15 namespace {
16 16
17 // TODO(zea): consider having dynamically-sized buffers if this becomes too 17 // TODO(zea): consider having dynamically-sized buffers if this becomes too
18 // expensive. 18 // expensive.
19 const uint32 kDefaultBufferSize = 8*1024; 19 const uint32 kDefaultBufferSize = 8*1024;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 DCHECK_EQ(last_error_, net::OK); 157 DCHECK_EQ(last_error_, net::OK);
158 if (read_buffer_->BytesConsumed() == next_pos_) 158 if (read_buffer_->BytesConsumed() == next_pos_)
159 return EMPTY; 159 return EMPTY;
160 160
161 return READY; 161 return READY;
162 } 162 }
163 163
164 void SocketInputStream::RefreshCompletionCallback( 164 void SocketInputStream::RefreshCompletionCallback(
165 const base::Closure& callback, int result) { 165 const base::Closure& callback, int result) {
166 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. 166 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed.
167 tracked_objects::ScopedProfile tracking_profile( 167 tracked_objects::ScopedTracker tracking_profile(
168 FROM_HERE_WITH_EXPLICIT_FUNCTION( 168 FROM_HERE_WITH_EXPLICIT_FUNCTION(
169 "418183 DoReadCallback => SocketInputStream::RefreshCompletionC...")); 169 "418183 DoReadCallback => SocketInputStream::RefreshCompletionC..."));
170 170
171 // If an error occurred before the completion callback could complete, ignore 171 // If an error occurred before the completion callback could complete, ignore
172 // the result. 172 // the result.
173 if (GetState() == CLOSED) 173 if (GetState() == CLOSED)
174 return; 174 return;
175 175
176 // Result == 0 implies EOF, which is treated as an error. 176 // Result == 0 implies EOF, which is treated as an error.
177 if (result == 0) 177 if (result == 0)
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 335
336 DVLOG(1) << "Socket flush complete."; 336 DVLOG(1) << "Socket flush complete.";
337 write_buffer_->SetOffset(0); 337 write_buffer_->SetOffset(0);
338 next_pos_ = 0; 338 next_pos_ = 0;
339 if (!callback.is_null()) 339 if (!callback.is_null())
340 callback.Run(); 340 callback.Run();
341 } 341 }
342 342
343 } // namespace gcm 343 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gaia/oauth2_token_service.cc ('k') | net/base/file_stream_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698