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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 return; | 557 return; |
558 | 558 |
559 for (size_t i = 0; | 559 for (size_t i = 0; |
560 i < previous_logged_events.size(); | 560 i < previous_logged_events.size(); |
561 i += kTraceEventBatchSize) { | 561 i += kTraceEventBatchSize) { |
562 scoped_refptr<RefCountedString> json_events_str_ptr = | 562 scoped_refptr<RefCountedString> json_events_str_ptr = |
563 new RefCountedString(); | 563 new RefCountedString(); |
564 TraceEvent::AppendEventsAsJSON(previous_logged_events, | 564 TraceEvent::AppendEventsAsJSON(previous_logged_events, |
565 i, | 565 i, |
566 kTraceEventBatchSize, | 566 kTraceEventBatchSize, |
567 &(json_events_str_ptr->data)); | 567 &(json_events_str_ptr->data())); |
568 output_callback_copy.Run(json_events_str_ptr); | 568 output_callback_copy.Run(json_events_str_ptr); |
569 } | 569 } |
570 } | 570 } |
571 | 571 |
572 int TraceLog::AddTraceEvent(char phase, | 572 int TraceLog::AddTraceEvent(char phase, |
573 const unsigned char* category_enabled, | 573 const unsigned char* category_enabled, |
574 const char* name, | 574 const char* name, |
575 unsigned long long id, | 575 unsigned long long id, |
576 int num_args, | 576 int num_args, |
577 const char** arg_names, | 577 const char** arg_names, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // Create a FNV hash from the process ID for XORing. | 756 // Create a FNV hash from the process ID for XORing. |
757 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. | 757 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. |
758 unsigned long long offset_basis = 14695981039346656037ull; | 758 unsigned long long offset_basis = 14695981039346656037ull; |
759 unsigned long long fnv_prime = 1099511628211ull; | 759 unsigned long long fnv_prime = 1099511628211ull; |
760 unsigned long long pid = static_cast<unsigned long long>(process_id_); | 760 unsigned long long pid = static_cast<unsigned long long>(process_id_); |
761 process_id_hash_ = (offset_basis ^ pid) * fnv_prime; | 761 process_id_hash_ = (offset_basis ^ pid) * fnv_prime; |
762 } | 762 } |
763 | 763 |
764 } // namespace debug | 764 } // namespace debug |
765 } // namespace base | 765 } // namespace base |
OLD | NEW |