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

Side by Side Diff: net/socket/stream_listen_socket.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 | « net/socket/ssl_client_socket_nss.cc ('k') | net/socket/tcp_client_socket.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/stream_listen_socket.h" 5 #include "net/socket/stream_listen_socket.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 // winsock2.h must be included first in order to ensure it is included before 8 // winsock2.h must be included first in order to ensure it is included before
9 // windows.h. 9 // windows.h.
10 #include <winsock2.h> 10 #include <winsock2.h>
11 #elif defined(OS_POSIX) 11 #elif defined(OS_POSIX)
12 #include <arpa/inet.h> 12 #include <arpa/inet.h>
13 #include <errno.h> 13 #include <errno.h>
14 #include <netinet/in.h> 14 #include <netinet/in.h>
15 #include <sys/socket.h> 15 #include <sys/socket.h>
16 #include <sys/types.h> 16 #include <sys/types.h>
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
18 #endif 18 #endif
19 19
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
22 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
23 #include "base/posix/eintr_wrapper.h" 23 #include "base/posix/eintr_wrapper.h"
24 #include "base/profiler/scoped_profile.h" 24 #include "base/profiler/scoped_tracker.h"
25 #include "base/sys_byteorder.h" 25 #include "base/sys_byteorder.h"
26 #include "base/threading/platform_thread.h" 26 #include "base/threading/platform_thread.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "net/base/ip_endpoint.h" 28 #include "net/base/ip_endpoint.h"
29 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
30 #include "net/base/net_util.h" 30 #include "net/base/net_util.h"
31 #include "net/socket/socket_descriptor.h" 31 #include "net/socket/socket_descriptor.h"
32 32
33 using std::string; 33 using std::string;
34 34
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 watcher_.StopWatching(); 240 watcher_.StopWatching();
241 #elif defined(OS_POSIX) 241 #elif defined(OS_POSIX)
242 watcher_.StopWatchingFileDescriptor(); 242 watcher_.StopWatchingFileDescriptor();
243 #endif 243 #endif
244 } 244 }
245 245
246 // TODO(ibrar): We can add these functions into OS dependent files. 246 // TODO(ibrar): We can add these functions into OS dependent files.
247 #if defined(OS_WIN) 247 #if defined(OS_WIN)
248 // MessageLoop watcher callback. 248 // MessageLoop watcher callback.
249 void StreamListenSocket::OnObjectSignaled(HANDLE object) { 249 void StreamListenSocket::OnObjectSignaled(HANDLE object) {
250 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. 250 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed.
251 tracked_objects::ScopedProfile tracking_profile( 251 tracked_objects::ScopedTracker tracking_profile(
252 FROM_HERE_WITH_EXPLICIT_FUNCTION( 252 FROM_HERE_WITH_EXPLICIT_FUNCTION("StreamListenSocket_OnObjectSignaled"));
253 "StreamListenSocket_OnObjectSignaled"));
254 253
255 WSANETWORKEVENTS ev; 254 WSANETWORKEVENTS ev;
256 if (kSocketError == WSAEnumNetworkEvents(socket_, socket_event_, &ev)) { 255 if (kSocketError == WSAEnumNetworkEvents(socket_, socket_event_, &ev)) {
257 // TODO 256 // TODO
258 return; 257 return;
259 } 258 }
260 259
261 // If both FD_CLOSE and FD_READ are set we only call Read(). 260 // If both FD_CLOSE and FD_READ are set we only call Read().
262 // This will cause OnObjectSignaled to be called immediately again 261 // This will cause OnObjectSignaled to be called immediately again
263 // unless this socket is destroyed in Read(). 262 // unless this socket is destroyed in Read().
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 void StreamListenSocket::ResumeReads() { 321 void StreamListenSocket::ResumeReads() {
323 DCHECK(reads_paused_); 322 DCHECK(reads_paused_);
324 reads_paused_ = false; 323 reads_paused_ = false;
325 if (has_pending_reads_) { 324 if (has_pending_reads_) {
326 has_pending_reads_ = false; 325 has_pending_reads_ = false;
327 Read(); 326 Read();
328 } 327 }
329 } 328 }
330 329
331 } // namespace net 330 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | net/socket/tcp_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698