| 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 #ifndef CHROME_BROWSER_GOOGLE_APIS_EVENT_LOGGER_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_EVENT_LOGGER_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_EVENT_LOGGER_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_EVENT_LOGGER_H_ |
| 7 | 7 |
| 8 #include <stdarg.h> // va_list | 8 #include <stdarg.h> // va_list |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 | 17 |
| 18 namespace google_apis { | 18 namespace google_apis { |
| 19 | 19 |
| 20 // The default history size used by EventLogger. | 20 // The default history size used by EventLogger. |
| 21 const int kDefaultHistorySize = 100; | 21 const int kDefaultHistorySize = 1000; |
| 22 | 22 |
| 23 // EventLogger is used to collect and expose text messages for diagnosing | 23 // EventLogger is used to collect and expose text messages for diagnosing |
| 24 // behaviors of Google APIs stuff. For instance, the collected messages are | 24 // behaviors of Google APIs stuff. For instance, the collected messages are |
| 25 // exposed to chrome:drive-internals. | 25 // exposed to chrome:drive-internals. |
| 26 class EventLogger { | 26 class EventLogger { |
| 27 public: | 27 public: |
| 28 // Represents a single event log. | 28 // Represents a single event log. |
| 29 struct Event { | 29 struct Event { |
| 30 Event(int id, const std::string& what); | 30 Event(int id, const std::string& what); |
| 31 int id; // Monotonically increasing ID starting from 0. | 31 int id; // Monotonically increasing ID starting from 0. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 size_t history_size_; // guarded by lock_. | 56 size_t history_size_; // guarded by lock_. |
| 57 int next_event_id_; // guarded by lock_. | 57 int next_event_id_; // guarded by lock_. |
| 58 base::Lock lock_; | 58 base::Lock lock_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(EventLogger); | 60 DISALLOW_COPY_AND_ASSIGN(EventLogger); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace google_apis | 63 } // namespace google_apis |
| 64 | 64 |
| 65 #endif // CHROME_BROWSER_GOOGLE_APIS_EVENT_LOGGER_H_ | 65 #endif // CHROME_BROWSER_GOOGLE_APIS_EVENT_LOGGER_H_ |
| OLD | NEW |