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

Side by Side Diff: chrome/browser/sync/engine/sync_scheduler.cc

Issue 7190001: [Sync] Split DirectoryChangeListener for thread-safety (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copyright Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/engine/sync_scheduler.h" 5 #include "chrome/browser/sync/engine/sync_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/rand_util.h" 13 #include "base/rand_util.h"
14 #include "base/tracked.h" 14 #include "base/tracked.h"
15 #include "chrome/browser/sync/engine/syncer.h" 15 #include "chrome/browser/sync/engine/syncer.h"
16 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" 16 #include "chrome/browser/sync/protocol/proto_enum_conversions.h"
17 #include "chrome/browser/sync/util/logging.h"
17 18
18 using base::TimeDelta; 19 using base::TimeDelta;
19 using base::TimeTicks; 20 using base::TimeTicks;
20 21
21 namespace browser_sync { 22 namespace browser_sync {
22 23
23 using sessions::SyncSession; 24 using sessions::SyncSession;
24 using sessions::SyncSessionSnapshot; 25 using sessions::SyncSessionSnapshot;
25 using sessions::SyncSourceInfo; 26 using sessions::SyncSourceInfo;
26 using syncable::ModelTypePayloadMap; 27 using syncable::ModelTypePayloadMap;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 default: 102 default:
102 NOTREACHED(); 103 NOTREACHED();
103 } 104 }
104 105
105 return GetUpdatesCallerInfo::UNKNOWN; 106 return GetUpdatesCallerInfo::UNKNOWN;
106 } 107 }
107 108
108 SyncScheduler::WaitInterval::WaitInterval(Mode mode, TimeDelta length) 109 SyncScheduler::WaitInterval::WaitInterval(Mode mode, TimeDelta length)
109 : mode(mode), had_nudge(false), length(length) { } 110 : mode(mode), had_nudge(false), length(length) { }
110 111
111 // Helper functions/macros to do logging with a Location object.
112
113 namespace {
114
115 bool VlogIsOn(const tracked_objects::Location& from_here,
116 int verbose_level) {
117 return (verbose_level <=
118 logging::GetVlogLevelHelper(
119 from_here.file_name(), ::strlen(from_here.file_name())));
120 }
121
122 } // namespace
123
124 #define VLOG_LOC_STREAM(from_here, verbose_level) \
125 logging::LogMessage(from_here.file_name(), from_here.line_number(), \
126 -verbose_level).stream()
127
128 #define VLOG_LOC(from_here, verbose_level) \
129 LAZY_STREAM(VLOG_LOC_STREAM(from_here, verbose_level), \
130 VLOG_IS_ON(verbose_level) || VlogIsOn(from_here, verbose_level))
131
132 // Helper macros to log with the syncer thread name; useful when there 112 // Helper macros to log with the syncer thread name; useful when there
133 // are multiple syncer threads involved. 113 // are multiple syncer threads involved.
134 114
135 #define SLOG(severity) LOG(severity) << name_ << ": " 115 #define SLOG(severity) LOG(severity) << name_ << ": "
136 116
137 #define SVLOG(verbose_level) VLOG(verbose_level) << name_ << ": " 117 #define SVLOG(verbose_level) VLOG(verbose_level) << name_ << ": "
138 118
139 #define SVLOG_LOC(from_here, verbose_level) \ 119 #define SVLOG_LOC(from_here, verbose_level) \
140 VLOG_LOC(from_here, verbose_level) << name_ << ": " 120 VLOG_LOC(from_here, verbose_level) << name_ << ": "
141 121
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1030
1051 #undef SLOG 1031 #undef SLOG
1052 1032
1053 #undef VLOG_LOC 1033 #undef VLOG_LOC
1054 1034
1055 #undef VLOG_LOC_STREAM 1035 #undef VLOG_LOC_STREAM
1056 1036
1057 #undef ENUM_CASE 1037 #undef ENUM_CASE
1058 1038
1059 } // browser_sync 1039 } // browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/process_updates_command.cc ('k') | chrome/browser/sync/engine/syncapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698