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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 return; | 516 return; |
517 | 517 |
518 for (size_t i = 0; | 518 for (size_t i = 0; |
519 i < previous_logged_events.size(); | 519 i < previous_logged_events.size(); |
520 i += kTraceEventBatchSize) { | 520 i += kTraceEventBatchSize) { |
521 scoped_refptr<RefCountedString> json_events_str_ptr = | 521 scoped_refptr<RefCountedString> json_events_str_ptr = |
522 new RefCountedString(); | 522 new RefCountedString(); |
523 TraceEvent::AppendEventsAsJSON(previous_logged_events, | 523 TraceEvent::AppendEventsAsJSON(previous_logged_events, |
524 i, | 524 i, |
525 kTraceEventBatchSize, | 525 kTraceEventBatchSize, |
526 &(json_events_str_ptr->data)); | 526 &(json_events_str_ptr->data())); |
527 output_callback_copy.Run(json_events_str_ptr); | 527 output_callback_copy.Run(json_events_str_ptr); |
528 } | 528 } |
529 } | 529 } |
530 | 530 |
531 int TraceLog::AddTraceEvent(char phase, | 531 int TraceLog::AddTraceEvent(char phase, |
532 const unsigned char* category_enabled, | 532 const unsigned char* category_enabled, |
533 const char* name, | 533 const char* name, |
534 unsigned long long id, | 534 unsigned long long id, |
535 int num_args, | 535 int num_args, |
536 const char** arg_names, | 536 const char** arg_names, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 // Create a FNV hash from the process ID for XORing. | 715 // Create a FNV hash from the process ID for XORing. |
716 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. | 716 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. |
717 unsigned long long offset_basis = 14695981039346656037ull; | 717 unsigned long long offset_basis = 14695981039346656037ull; |
718 unsigned long long fnv_prime = 1099511628211ull; | 718 unsigned long long fnv_prime = 1099511628211ull; |
719 unsigned long long pid = static_cast<unsigned long long>(process_id_); | 719 unsigned long long pid = static_cast<unsigned long long>(process_id_); |
720 process_id_hash_ = (offset_basis ^ pid) * fnv_prime; | 720 process_id_hash_ = (offset_basis ^ pid) * fnv_prime; |
721 } | 721 } |
722 | 722 |
723 } // namespace debug | 723 } // namespace debug |
724 } // namespace base | 724 } // namespace base |
OLD | NEW |