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

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

Issue 386030: Relieve SyncerSession,SyncCycleState, SyncProcessState, SyncerSession, Syncer... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/syncer_command.h" 5 #include "chrome/browser/sync/engine/syncer_command.h"
6 6
7 #include "chrome/browser/sync/engine/net/server_connection_manager.h" 7 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
8 #include "chrome/browser/sync/engine/syncer_session.h" 8 #include "chrome/browser/sync/sessions/sync_session.h"
9 #include "chrome/browser/sync/engine/syncer_status.h"
10 #include "chrome/browser/sync/syncable/directory_manager.h" 9 #include "chrome/browser/sync/syncable/directory_manager.h"
11 #include "chrome/browser/sync/util/event_sys-inl.h" 10 #include "chrome/browser/sync/util/event_sys-inl.h"
12 #include "chrome/browser/sync/util/sync_types.h" 11 #include "chrome/browser/sync/util/sync_types.h"
13 12
14 namespace browser_sync { 13 namespace browser_sync {
14 using sessions::SyncSession;
15 15
16 SyncerCommand::SyncerCommand() {} 16 SyncerCommand::SyncerCommand() {}
17 SyncerCommand::~SyncerCommand() {} 17 SyncerCommand::~SyncerCommand() {}
18 18
19 void SyncerCommand::Execute(SyncerSession* session) { 19 void SyncerCommand::Execute(SyncSession* session) {
20 ExecuteImpl(session); 20 ExecuteImpl(session);
21 SendNotifications(session); 21 SendNotifications(session);
22 } 22 }
23 23
24 void SyncerCommand::SendNotifications(SyncerSession* session) { 24 void SyncerCommand::SendNotifications(SyncSession* session) {
25 syncable::ScopedDirLookup dir(session->dirman(), session->account_name()); 25 syncable::ScopedDirLookup dir(session->context()->directory_manager(),
26 session->context()->account_name());
26 if (!dir.good()) { 27 if (!dir.good()) {
27 LOG(ERROR) << "Scoped dir lookup failed!"; 28 LOG(ERROR) << "Scoped dir lookup failed!";
28 return; 29 return;
29 } 30 }
30 31
31 SyncerStatus status(session); 32 if (session->status_controller()->TestAndClearIsDirty()) {
32 33 SyncerEvent event(SyncerEvent::STATUS_CHANGED);
33 if (status.IsDirty()) { 34 const sessions::SyncSessionSnapshot& snapshot(session->TakeSnapshot());
34 SyncerEvent event = { SyncerEvent::STATUS_CHANGED}; 35 event.snapshot = &snapshot;
35 event.last_session = session; 36 DCHECK(session->context()->syncer_event_channel());
36 session->syncer_event_channel()->NotifyListeners(event); 37 session->context()->syncer_event_channel()->NotifyListeners(event);
37 if (status.over_quota()) { 38 if (session->status_controller()->syncer_status().over_quota) {
38 SyncerEvent quota_event = {SyncerEvent::OVER_QUOTA}; 39 SyncerEvent quota_event(SyncerEvent::OVER_QUOTA);
39 quota_event.last_session = session; 40 quota_event.snapshot = &snapshot;
40 session->syncer_event_channel()->NotifyListeners(quota_event); 41 session->context()->syncer_event_channel()->NotifyListeners(quota_event);
41 } 42 }
42 status.SetClean();
43 } 43 }
44 if (status.IsAuthDirty()) { 44 if (session->auth_failure_occurred()) {
45 ServerConnectionEvent event; 45 ServerConnectionEvent event;
46 event.what_happened = ServerConnectionEvent::STATUS_CHANGED; 46 event.what_happened = ServerConnectionEvent::STATUS_CHANGED;
47 event.server_reachable = true; 47 event.server_reachable = true;
48 event.connection_code = HttpResponse::SYNC_AUTH_ERROR; 48 event.connection_code = HttpResponse::SYNC_AUTH_ERROR;
49 session->connection_manager()->channel()->NotifyListeners(event); 49 session->context()->connection_manager()->channel()->NotifyListeners(event);
50 status.SetAuthClean(); 50 session->clear_auth_failure_occurred();
51 } 51 }
52 } 52 }
53 53
54 } // namespace browser_sync 54 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_command.h ('k') | chrome/browser/sync/engine/syncer_end_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698