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

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

Issue 246098: Sync: Remove pthreads from auth_watcher. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/syncapi.h" 5 #include "chrome/browser/sync/engine/syncapi.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 875
876 // A multi-purpose status watch object that aggregates stats from various 876 // A multi-purpose status watch object that aggregates stats from various
877 // sync components. 877 // sync components.
878 AllStatus allstatus_; 878 AllStatus allstatus_;
879 879
880 // AuthWatcher kicks off the authentication process and follows it through 880 // AuthWatcher kicks off the authentication process and follows it through
881 // phase 1 (GAIA) to phase 2 (sync engine). As part of this work it determines 881 // phase 1 (GAIA) to phase 2 (sync engine). As part of this work it determines
882 // the initial connectivity and causes the server connection event to be 882 // the initial connectivity and causes the server connection event to be
883 // broadcast, which signals the syncer thread to start syncing. 883 // broadcast, which signals the syncer thread to start syncing.
884 // It has a heavy duty constructor requiring boilerplate so we heap allocate. 884 // It has a heavy duty constructor requiring boilerplate so we heap allocate.
885 scoped_ptr<AuthWatcher> auth_watcher_; 885 scoped_refptr<AuthWatcher> auth_watcher_;
886 886
887 // A store of change records produced by HandleChangeEvent during the 887 // A store of change records produced by HandleChangeEvent during the
888 // CALCULATE_CHANGES step, and to be processed, and forwarded to the 888 // CALCULATE_CHANGES step, and to be processed, and forwarded to the
889 // observer, by HandleChangeEvent during the TRANSACTION_COMPLETE step. 889 // observer, by HandleChangeEvent during the TRANSACTION_COMPLETE step.
890 ChangeReorderBuffer change_buffer_; 890 ChangeReorderBuffer change_buffer_;
891 891
892 // The event listener hookup that is registered for HandleChangeEvent. 892 // The event listener hookup that is registered for HandleChangeEvent.
893 scoped_ptr<EventListenerHookup> dir_change_hookup_; 893 scoped_ptr<EventListenerHookup> dir_change_hookup_;
894 894
895 // The event listener hookup registered for HandleSyncerEvent. 895 // The event listener hookup registered for HandleSyncerEvent.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 std::string gaia_url = browser_sync::kGaiaUrl; 1026 std::string gaia_url = browser_sync::kGaiaUrl;
1027 const char* service_id = gaia_service_id ? 1027 const char* service_id = gaia_service_id ?
1028 gaia_service_id : SYNC_SERVICE_NAME; 1028 gaia_service_id : SYNC_SERVICE_NAME;
1029 1029
1030 talk_mediator_.reset(new TalkMediatorImpl()); 1030 talk_mediator_.reset(new TalkMediatorImpl());
1031 allstatus()->WatchTalkMediator(talk_mediator()); 1031 allstatus()->WatchTalkMediator(talk_mediator());
1032 1032
1033 BridgedGaiaAuthenticator* gaia_auth = new BridgedGaiaAuthenticator( 1033 BridgedGaiaAuthenticator* gaia_auth = new BridgedGaiaAuthenticator(
1034 gaia_source, service_id, gaia_url, auth_post_factory); 1034 gaia_source, service_id, gaia_url, auth_post_factory);
1035 1035
1036 auth_watcher_.reset(new AuthWatcher(dir_manager(), 1036 auth_watcher_ = new AuthWatcher(dir_manager(),
1037 connection_manager(), 1037 connection_manager(),
1038 &allstatus_, 1038 &allstatus_,
1039 gaia_source, 1039 gaia_source,
1040 service_id, 1040 service_id,
1041 gaia_url, 1041 gaia_url,
1042 user_settings_.get(), 1042 user_settings_.get(),
1043 gaia_auth, 1043 gaia_auth,
1044 talk_mediator())); 1044 talk_mediator());
1045 1045
1046 talk_mediator()->WatchAuthWatcher(auth_watcher()); 1046 talk_mediator()->WatchAuthWatcher(auth_watcher());
1047 allstatus()->WatchAuthWatcher(auth_watcher()); 1047 allstatus()->WatchAuthWatcher(auth_watcher());
1048 authwatcher_hookup_.reset(NewEventListenerHookup(auth_watcher_->channel(), 1048 authwatcher_hookup_.reset(NewEventListenerHookup(auth_watcher_->channel(),
1049 this, &SyncInternal::HandleAuthWatcherEvent)); 1049 this, &SyncInternal::HandleAuthWatcherEvent));
1050 1050
1051 // Tell the SyncerThread to use the ModelSafeWorker for bookmark model work. 1051 // Tell the SyncerThread to use the ModelSafeWorker for bookmark model work.
1052 // We set up both sides of the "bridge" here, with the ModelSafeWorkerBridge 1052 // We set up both sides of the "bridge" here, with the ModelSafeWorkerBridge
1053 // on the Syncer side, and |model_safe_worker| on the API client side. 1053 // on the Syncer side, and |model_safe_worker| on the API client side.
1054 ModelSafeWorkerBridge* worker = new ModelSafeWorkerBridge(model_safe_worker); 1054 ModelSafeWorkerBridge* worker = new ModelSafeWorkerBridge(model_safe_worker);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 1165
1166 void SyncManager::Shutdown() { 1166 void SyncManager::Shutdown() {
1167 data_->Shutdown(); 1167 data_->Shutdown();
1168 } 1168 }
1169 1169
1170 void SyncManager::SyncInternal::Shutdown() { 1170 void SyncManager::SyncInternal::Shutdown() {
1171 // First reset the AuthWatcher in case an auth attempt is in progress so that 1171 // First reset the AuthWatcher in case an auth attempt is in progress so that
1172 // it terminates gracefully before we shutdown and close other components. 1172 // it terminates gracefully before we shutdown and close other components.
1173 // Otherwise the attempt can complete after we've closed the directory, for 1173 // Otherwise the attempt can complete after we've closed the directory, for
1174 // example, and cause initialization to continue, which is bad. 1174 // example, and cause initialization to continue, which is bad.
1175 auth_watcher_.reset(); 1175 auth_watcher_->Shutdown();
1176 auth_watcher_ = NULL;
1176 1177
1177 if (syncer_thread()) { 1178 if (syncer_thread()) {
1178 if (!syncer_thread()->Stop(kThreadExitTimeoutMsec)) 1179 if (!syncer_thread()->Stop(kThreadExitTimeoutMsec))
1179 DCHECK(false) << "Unable to stop the syncer, it won't be happy..."; 1180 DCHECK(false) << "Unable to stop the syncer, it won't be happy...";
1180 } 1181 }
1181 1182
1182 // Shutdown the xmpp buzz connection. 1183 // Shutdown the xmpp buzz connection.
1183 LOG(INFO) << "P2P: Mediator logout started."; 1184 LOG(INFO) << "P2P: Mediator logout started.";
1184 if (talk_mediator()) { 1185 if (talk_mediator()) {
1185 talk_mediator()->Logout(); 1186 talk_mediator()->Logout();
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 BaseTransaction::~BaseTransaction() { 1551 BaseTransaction::~BaseTransaction() {
1551 delete lookup_; 1552 delete lookup_;
1552 } 1553 }
1553 1554
1554 UserShare* SyncManager::GetUserShare() const { 1555 UserShare* SyncManager::GetUserShare() const {
1555 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; 1556 DCHECK(data_->initialized()) << "GetUserShare requires initialization!";
1556 return data_->GetUserShare(); 1557 return data_->GetUserShare();
1557 } 1558 }
1558 1559
1559 } // namespace sync_api 1560 } // namespace sync_api
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/net/server_connection_manager.h ('k') | chrome/browser/sync/notifier/listener/talk_mediator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698