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

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

Issue 2533953005: Standardize "net" category trace events (Closed)
Patch Set: Rebased Created 4 years 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/client_socket_pool_base.cc ('k') | net/socket/ssl_client_socket_impl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/socket_posix.h" 5 #include "net/socket/socket_posix.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/posix/eintr_wrapper.h" 15 #include "base/posix/eintr_wrapper.h"
16 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
19 #include "net/base/ip_endpoint.h" 19 #include "net/base/ip_endpoint.h"
20 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
21 #include "net/base/sockaddr_storage.h" 21 #include "net/base/sockaddr_storage.h"
22 #include "net/base/trace_constants.h"
22 23
23 namespace net { 24 namespace net {
24 25
25 namespace { 26 namespace {
26 27
27 int MapAcceptError(int os_error) { 28 int MapAcceptError(int os_error) {
28 switch (os_error) { 29 switch (os_error) {
29 // If the client aborts the connection before the server calls accept, 30 // If the client aborts the connection before the server calls accept,
30 // POSIX specifies accept should fail with ECONNABORTED. The server can 31 // POSIX specifies accept should fail with ECONNABORTED. The server can
31 // ignore the error and just call accept again, so we map the error to 32 // ignore the error and just call accept again, so we map the error to
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 PLOG(ERROR) << "close() returned an error, errno=" << errno; 363 PLOG(ERROR) << "close() returned an error, errno=" << errno;
363 socket_fd_ = kInvalidSocket; 364 socket_fd_ = kInvalidSocket;
364 } 365 }
365 } 366 }
366 367
367 void SocketPosix::DetachFromThread() { 368 void SocketPosix::DetachFromThread() {
368 thread_checker_.DetachFromThread(); 369 thread_checker_.DetachFromThread();
369 } 370 }
370 371
371 void SocketPosix::OnFileCanReadWithoutBlocking(int fd) { 372 void SocketPosix::OnFileCanReadWithoutBlocking(int fd) {
372 TRACE_EVENT0("net", "SocketPosix::OnFileCanReadWithoutBlocking"); 373 TRACE_EVENT0(kNetTracingCategory,
374 "SocketPosix::OnFileCanReadWithoutBlocking");
373 DCHECK(!accept_callback_.is_null() || !read_callback_.is_null()); 375 DCHECK(!accept_callback_.is_null() || !read_callback_.is_null());
374 if (!accept_callback_.is_null()) { 376 if (!accept_callback_.is_null()) {
375 AcceptCompleted(); 377 AcceptCompleted();
376 } else { // !read_callback_.is_null() 378 } else { // !read_callback_.is_null()
377 ReadCompleted(); 379 ReadCompleted();
378 } 380 }
379 } 381 }
380 382
381 void SocketPosix::OnFileCanWriteWithoutBlocking(int fd) { 383 void SocketPosix::OnFileCanWriteWithoutBlocking(int fd) {
382 DCHECK(!write_callback_.is_null()); 384 DCHECK(!write_callback_.is_null());
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 write_buf_ = NULL; 510 write_buf_ = NULL;
509 write_buf_len_ = 0; 511 write_buf_len_ = 0;
510 write_callback_.Reset(); 512 write_callback_.Reset();
511 } 513 }
512 514
513 waiting_connect_ = false; 515 waiting_connect_ = false;
514 peer_address_.reset(); 516 peer_address_.reset();
515 } 517 }
516 518
517 } // namespace net 519 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base.cc ('k') | net/socket/ssl_client_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698