summaryrefslogtreecommitdiffstats
path: root/sync/sessions
diff options
context:
space:
mode:
authorhaitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-29 06:50:45 +0000
committerhaitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-29 06:50:45 +0000
commita3cdfcfd2e526d6a6650ba790b6b8763ae9aadad (patch)
tree4c4b68b646b62c8ff4781b56c2cf72a53c430744 /sync/sessions
parenta1f34c689182824d6b8d4f87e1f9eb44092dd2b9 (diff)
downloadchromium_src-a3cdfcfd2e526d6a6650ba790b6b8763ae9aadad.zip
chromium_src-a3cdfcfd2e526d6a6650ba790b6b8763ae9aadad.tar.gz
chromium_src-a3cdfcfd2e526d6a6650ba790b6b8763ae9aadad.tar.bz2
Worker changes to prepare for lock-free shutdown.
* Make worker observe the destruction of the thread where it does work. * Make work done signal a memeber of worker and set it when worker's working thread is destroyed so that syncer won't be blocked indefinitely on work that's not gonna run. * Ref-count worker in session context so that worker remains valid when syncer is still iterating through workers but registrar has erased it from its worker map. * Add RequestStop() and Stopped() to allow worker to return early when it's stopped while waiting to run work on its working thread. This cl by itself should have no real impact because the added functions are not used. BUG=19757 Review URL: https://chromiumcodereview.appspot.com/14046031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/sessions')
-rw-r--r--sync/sessions/sync_session_context.cc4
-rw-r--r--sync/sessions/sync_session_context.h4
2 files changed, 5 insertions, 3 deletions
diff --git a/sync/sessions/sync_session_context.cc b/sync/sessions/sync_session_context.cc
index f931f4c..41ed246 100644
--- a/sync/sessions/sync_session_context.cc
+++ b/sync/sessions/sync_session_context.cc
@@ -27,7 +27,6 @@ SyncSessionContext::SyncSessionContext(
const std::string& invalidator_client_id)
: connection_manager_(connection_manager),
directory_(directory),
- workers_(workers),
extensions_activity_monitor_(extensions_activity_monitor),
notifications_enabled_(false),
max_commit_batch_size_(kDefaultMaxCommitBatchSize),
@@ -36,6 +35,9 @@ SyncSessionContext::SyncSessionContext(
traffic_recorder_(traffic_recorder),
keystore_encryption_enabled_(keystore_encryption_enabled),
invalidator_client_id_(invalidator_client_id) {
+ for (size_t i = 0u; i < workers.size(); ++i)
+ workers_.push_back(workers[i]);
+
std::vector<SyncEngineEventListener*>::const_iterator it;
for (it = listeners.begin(); it != listeners.end(); ++it)
listeners_.AddObserver(*it);
diff --git a/sync/sessions/sync_session_context.h b/sync/sessions/sync_session_context.h
index 755e574..a6f693a 100644
--- a/sync/sessions/sync_session_context.h
+++ b/sync/sessions/sync_session_context.h
@@ -76,7 +76,7 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext {
routing_info_ = routing_info;
}
- const std::vector<ModelSafeWorker*> workers() const {
+ const std::vector<scoped_refptr<ModelSafeWorker> >& workers() const {
return workers_;
}
@@ -151,7 +151,7 @@ class SYNC_EXPORT_PRIVATE SyncSessionContext {
ModelSafeRoutingInfo routing_info_;
// The set of ModelSafeWorkers. Used to execute tasks of various threads.
- const std::vector<ModelSafeWorker*> workers_;
+ std::vector<scoped_refptr<ModelSafeWorker> > workers_;
// We use this to stuff extensions activity into CommitMessages so the server
// can correlate commit traffic with extension-related bookmark mutations.