Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 | 138 |
| 139 } // namespace | 139 } // namespace |
| 140 | 140 |
| 141 TraceEvent::TraceEvent() | 141 TraceEvent::TraceEvent() |
| 142 : id_(0u), | 142 : id_(0u), |
| 143 category_enabled_(NULL), | 143 category_enabled_(NULL), |
| 144 name_(NULL), | 144 name_(NULL), |
| 145 thread_id_(0), | 145 thread_id_(0), |
| 146 phase_(TRACE_EVENT_PHASE_BEGIN), | 146 phase_(TRACE_EVENT_PHASE_BEGIN), |
| 147 flags_(0) { | 147 flags_(0) { |
| 148 arg_names_[0] = NULL; | 148 memset(arg_names_, 0, sizeof(arg_names_)); |
|
groby-ooo-7-16
2012/02/06 18:39:48
Technically, the old way was OK - those are both s
James Hawkins
2012/02/07 21:09:21
You're right, and Coverity wasn't even complaining
| |
| 149 arg_names_[1] = NULL; | 149 memset(arg_values_, 0, sizeof(arg_values_)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 TraceEvent::TraceEvent(int thread_id, | 152 TraceEvent::TraceEvent(int thread_id, |
| 153 TimeTicks timestamp, | 153 TimeTicks timestamp, |
| 154 char phase, | 154 char phase, |
| 155 const unsigned char* category_enabled, | 155 const unsigned char* category_enabled, |
| 156 const char* name, | 156 const char* name, |
| 157 unsigned long long id, | 157 unsigned long long id, |
| 158 int num_args, | 158 int num_args, |
| 159 const char** arg_names, | 159 const char** arg_names, |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 714 // Create a FNV hash from the process ID for XORing. | 714 // Create a FNV hash from the process ID for XORing. |
| 715 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. | 715 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. |
| 716 unsigned long long offset_basis = 14695981039346656037ull; | 716 unsigned long long offset_basis = 14695981039346656037ull; |
| 717 unsigned long long fnv_prime = 1099511628211ull; | 717 unsigned long long fnv_prime = 1099511628211ull; |
| 718 unsigned long long pid = static_cast<unsigned long long>(process_id_); | 718 unsigned long long pid = static_cast<unsigned long long>(process_id_); |
| 719 process_id_hash_ = (offset_basis ^ pid) * fnv_prime; | 719 process_id_hash_ = (offset_basis ^ pid) * fnv_prime; |
| 720 } | 720 } |
| 721 | 721 |
| 722 } // namespace debug | 722 } // namespace debug |
| 723 } // namespace base | 723 } // namespace base |
| OLD | NEW |