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

Side by Side Diff: chrome/browser/sync/engine/model_changing_syncer_command.h

Issue 8366030: Introduce the plumbing necessary to report Unrecoverable error from model safe workers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 9 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) 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 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ 6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/sync/engine/syncer_command.h" 9 #include "chrome/browser/sync/engine/syncer_command.h"
10 #include "chrome/browser/sync/sessions/unrecoverable_error_info.h"
10 11
11 namespace browser_sync { 12 namespace browser_sync {
12 namespace sessions { 13 namespace sessions {
13 class SyncSession; 14 class SyncSession;
14 } 15 }
15 16
16 // An abstract SyncerCommand which dispatches its Execute step to the 17 // An abstract SyncerCommand which dispatches its Execute step to the
17 // model-safe worker thread. Classes derived from ModelChangingSyncerCommand 18 // model-safe worker thread. Classes derived from ModelChangingSyncerCommand
18 // instead of SyncerCommand must implement ModelChangingExecuteImpl instead of 19 // instead of SyncerCommand must implement ModelChangingExecuteImpl instead of
19 // ExecuteImpl, but otherwise, the contract is the same. 20 // ExecuteImpl, but otherwise, the contract is the same.
20 // 21 //
21 // A command should derive from ModelChangingSyncerCommand instead of 22 // A command should derive from ModelChangingSyncerCommand instead of
22 // SyncerCommand whenever the operation might change any client-visible 23 // SyncerCommand whenever the operation might change any client-visible
23 // fields on any syncable::Entry. If the operation involves creating a 24 // fields on any syncable::Entry. If the operation involves creating a
24 // WriteTransaction, this is a sign that ModelChangingSyncerCommand is likely 25 // WriteTransaction, this is a sign that ModelChangingSyncerCommand is likely
25 // necessary. 26 // necessary.
26 class ModelChangingSyncerCommand : public SyncerCommand { 27 class ModelChangingSyncerCommand : public SyncerCommand {
27 public: 28 public:
28 ModelChangingSyncerCommand() : work_session_(NULL) { } 29 ModelChangingSyncerCommand() : work_session_(NULL) { }
29 virtual ~ModelChangingSyncerCommand() { } 30 virtual ~ModelChangingSyncerCommand() { }
30 31
31 // SyncerCommand implementation. Sets work_session to session. 32 // SyncerCommand implementation. Sets work_session to session.
32 virtual void ExecuteImpl(sessions::SyncSession* session); 33 virtual void ExecuteImpl(sessions::SyncSession* session);
33 34
34 // wrapper so implementations don't worry about storing work_session 35 // wrapper so implementations don't worry about storing work_session
35 void StartChangingModel() { 36 void StartChangingModel(sessions::UnrecoverableErrorInfo* error_info) {
akalin 2011/10/25 03:20:06 if you're going to change this, this should return
akalin 2011/10/25 03:29:41 Sorry, I got confused. This is the function that
lipalani1 2011/10/26 00:12:13 I dont want to change this internally just yet. Le
lipalani1 2011/10/26 00:12:13 Done.
37 // TODO(lipalani): Pass in error_info parameter to this function.
akalin 2011/10/25 03:29:41 The TODO should read: Change ModelChangingExecuteI
lipalani1 2011/10/26 00:12:13 Done.
36 ModelChangingExecuteImpl(work_session_); 38 ModelChangingExecuteImpl(work_session_);
37 } 39 }
38 40
39 // Sometimes, a command has work to do that needs to touch global state 41 // Sometimes, a command has work to do that needs to touch global state
40 // belonging to multiple ModelSafeGroups, but in a way that is known to be 42 // belonging to multiple ModelSafeGroups, but in a way that is known to be
41 // safe. This will be called once, prior to ModelChangingExecuteImpl, 43 // safe. This will be called once, prior to ModelChangingExecuteImpl,
42 // *without* a ModelSafeGroup restriction in place on the SyncSession. 44 // *without* a ModelSafeGroup restriction in place on the SyncSession.
43 // Returns true on success, false on failure. 45 // Returns true on success, false on failure.
44 // TODO(tim): Remove this (bug 36594). 46 // TODO(tim): Remove this (bug 36594).
45 virtual bool ModelNeutralExecuteImpl(sessions::SyncSession* session); 47 virtual bool ModelNeutralExecuteImpl(sessions::SyncSession* session);
(...skipping 10 matching lines...) Expand all
56 // Implementations will implement ModelChangingExecuteImpl and not 58 // Implementations will implement ModelChangingExecuteImpl and not
57 // worry about storing the session or setting it. They are given work_session. 59 // worry about storing the session or setting it. They are given work_session.
58 sessions::SyncSession* work_session_; 60 sessions::SyncSession* work_session_;
59 61
60 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand); 62 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand);
61 }; 63 };
62 64
63 } // namespace browser_sync 65 } // namespace browser_sync
64 66
65 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ 67 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698