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

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

Issue 646273003: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « no previous file | net/spdy/spdy_session.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 "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
10 #include "net/socket/stream_socket.h" 11 #include "net/socket/stream_socket.h"
11 12
12 namespace gcm { 13 namespace gcm {
13 14
14 namespace { 15 namespace {
15 16
16 // TODO(zea): consider having dynamically-sized buffers if this becomes too 17 // TODO(zea): consider having dynamically-sized buffers if this becomes too
17 // expensive. 18 // expensive.
18 const uint32 kDefaultBufferSize = 8*1024; 19 const uint32 kDefaultBufferSize = 8*1024;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 156
156 DCHECK_EQ(last_error_, net::OK); 157 DCHECK_EQ(last_error_, net::OK);
157 if (read_buffer_->BytesConsumed() == next_pos_) 158 if (read_buffer_->BytesConsumed() == next_pos_)
158 return EMPTY; 159 return EMPTY;
159 160
160 return READY; 161 return READY;
161 } 162 }
162 163
163 void SocketInputStream::RefreshCompletionCallback( 164 void SocketInputStream::RefreshCompletionCallback(
164 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.
167 tracked_objects::ScopedProfile tracking_profile(
168 FROM_HERE_WITH_EXPLICIT_FUNCTION(
169 "418183 DoReadCallback => SocketInputStream::RefreshCompletionC..."));
170
165 // If an error occurred before the completion callback could complete, ignore 171 // If an error occurred before the completion callback could complete, ignore
166 // the result. 172 // the result.
167 if (GetState() == CLOSED) 173 if (GetState() == CLOSED)
168 return; 174 return;
169 175
170 // Result == 0 implies EOF, which is treated as an error. 176 // Result == 0 implies EOF, which is treated as an error.
171 if (result == 0) 177 if (result == 0)
172 result = net::ERR_CONNECTION_CLOSED; 178 result = net::ERR_CONNECTION_CLOSED;
173 179
174 DCHECK_NE(result, net::ERR_IO_PENDING); 180 DCHECK_NE(result, net::ERR_IO_PENDING);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 334 }
329 335
330 DVLOG(1) << "Socket flush complete."; 336 DVLOG(1) << "Socket flush complete.";
331 write_buffer_->SetOffset(0); 337 write_buffer_->SetOffset(0);
332 next_pos_ = 0; 338 next_pos_ = 0;
333 if (!callback.is_null()) 339 if (!callback.is_null())
334 callback.Run(); 340 callback.Run();
335 } 341 }
336 342
337 } // namespace gcm 343 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698