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

Side by Side Diff: chrome/browser/sync_file_system/task_logger.cc

Issue 337073002: [SyncFS] Add EVENT_TRACE to SyncTaskToken (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync_file_system/task_logger.h ('k') | no next file » | 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 "chrome/browser/sync_file_system/task_logger.h" 5 #include "chrome/browser/sync_file_system/task_logger.h"
6 6
7 #include "base/lazy_instance.h"
7 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/synchronization/lock.h"
8 10
9 namespace sync_file_system { 11 namespace sync_file_system {
10 12
11 namespace { 13 namespace {
14
12 const size_t kMaxLogSize = 500; 15 const size_t kMaxLogSize = 500;
16
17 int g_next_log_id = 1;
18 base::LazyInstance<base::Lock>::Leaky g_log_id_lock = LAZY_INSTANCE_INITIALIZER;
19
20 int GenerateLogID() {
21 base::AutoLock lock(g_log_id_lock.Get());
22 return g_next_log_id++;
23 }
24
13 } // namespace 25 } // namespace
14 26
15 typedef TaskLogger::TaskLog TaskLog; 27 typedef TaskLogger::TaskLog TaskLog;
16 28
17 TaskLogger::TaskLog::TaskLog() {} 29 TaskLogger::TaskLog::TaskLog() : log_id(GenerateLogID()) {}
18 TaskLogger::TaskLog::~TaskLog() {} 30 TaskLogger::TaskLog::~TaskLog() {}
19 31
20 TaskLogger::TaskLogger() {} 32 TaskLogger::TaskLogger() {}
21 33
22 TaskLogger::~TaskLogger() { 34 TaskLogger::~TaskLogger() {
23 ClearLog(); 35 ClearLog();
24 } 36 }
25 37
26 void TaskLogger::RecordLog(scoped_ptr<TaskLog> log) { 38 void TaskLogger::RecordLog(scoped_ptr<TaskLog> log) {
27 if (!log) 39 if (!log)
(...skipping 21 matching lines...) Expand all
49 61
50 void TaskLogger::RemoveObserver(Observer* observer) { 62 void TaskLogger::RemoveObserver(Observer* observer) {
51 observers_.RemoveObserver(observer); 63 observers_.RemoveObserver(observer);
52 } 64 }
53 65
54 const TaskLogger::LogList& TaskLogger::GetLog() const { 66 const TaskLogger::LogList& TaskLogger::GetLog() const {
55 return log_history_; 67 return log_history_;
56 } 68 }
57 69
58 } // namespace sync_file_system 70 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/task_logger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698