OLD | NEW |
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/drive_backend/sync_task_token.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" |
8 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" | 9 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
9 #include "chrome/browser/sync_file_system/drive_backend/task_dependency_manager.
h" | 10 #include "chrome/browser/sync_file_system/drive_backend/task_dependency_manager.
h" |
10 | 11 |
11 namespace sync_file_system { | 12 namespace sync_file_system { |
12 namespace drive_backend { | 13 namespace drive_backend { |
13 | 14 |
14 const int64 SyncTaskToken::kTestingTaskTokenID = -1; | 15 const int64 SyncTaskToken::kTestingTaskTokenID = -1; |
15 const int64 SyncTaskToken::kForegroundTaskTokenID = 0; | 16 const int64 SyncTaskToken::kForegroundTaskTokenID = 0; |
16 const int64 SyncTaskToken::kMinimumBackgroundTaskTokenID = 1; | 17 const int64 SyncTaskToken::kMinimumBackgroundTaskTokenID = 1; |
17 | 18 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 91 } |
91 | 92 |
92 void SyncTaskToken::clear_blocking_factor() { | 93 void SyncTaskToken::clear_blocking_factor() { |
93 blocking_factor_.reset(); | 94 blocking_factor_.reset(); |
94 } | 95 } |
95 | 96 |
96 void SyncTaskToken::InitializeTaskLog(const std::string& task_description) { | 97 void SyncTaskToken::InitializeTaskLog(const std::string& task_description) { |
97 task_log_.reset(new TaskLogger::TaskLog); | 98 task_log_.reset(new TaskLogger::TaskLog); |
98 task_log_->start_time = base::TimeTicks::Now(); | 99 task_log_->start_time = base::TimeTicks::Now(); |
99 task_log_->task_description = task_description; | 100 task_log_->task_description = task_description; |
| 101 |
| 102 TRACE_EVENT_ASYNC_BEGIN1( |
| 103 TRACE_DISABLED_BY_DEFAULT("SyncFileSystem"), |
| 104 "SyncTask", task_log_->log_id, |
| 105 "task_description", task_description); |
100 } | 106 } |
101 | 107 |
102 void SyncTaskToken::FinalizeTaskLog(const std::string& result_description) { | 108 void SyncTaskToken::FinalizeTaskLog(const std::string& result_description) { |
| 109 TRACE_EVENT_ASYNC_END1( |
| 110 TRACE_DISABLED_BY_DEFAULT("SyncFileSystem"), |
| 111 "SyncTask", task_log_->log_id, |
| 112 "result_description", result_description); |
| 113 |
103 DCHECK(task_log_); | 114 DCHECK(task_log_); |
104 task_log_->result_description = result_description; | 115 task_log_->result_description = result_description; |
105 task_log_->end_time = base::TimeTicks::Now(); | 116 task_log_->end_time = base::TimeTicks::Now(); |
106 } | 117 } |
107 | 118 |
108 void SyncTaskToken::RecordLog(const std::string& message) { | 119 void SyncTaskToken::RecordLog(const std::string& message) { |
109 DCHECK(task_log_); | 120 DCHECK(task_log_); |
110 task_log_->details.push_back(message); | 121 task_log_->details.push_back(message); |
111 } | 122 } |
112 | 123 |
(...skipping 10 matching lines...) Expand all Loading... |
123 scoped_ptr<BlockingFactor> blocking_factor, | 134 scoped_ptr<BlockingFactor> blocking_factor, |
124 const SyncStatusCallback& callback) | 135 const SyncStatusCallback& callback) |
125 : manager_(manager), | 136 : manager_(manager), |
126 token_id_(token_id), | 137 token_id_(token_id), |
127 callback_(callback), | 138 callback_(callback), |
128 blocking_factor_(blocking_factor.Pass()) { | 139 blocking_factor_(blocking_factor.Pass()) { |
129 } | 140 } |
130 | 141 |
131 } // namespace drive_backend | 142 } // namespace drive_backend |
132 } // namespace sync_file_system | 143 } // namespace sync_file_system |
OLD | NEW |