Android WebView: post QuotaManager calls to UI thread.
[chromium-blink-merge.git] / sync / engine / syncer_command.h
blob303aad53907f3fc0a66e27c30abc5f859a25027e
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SYNC_ENGINE_SYNCER_COMMAND_H_
6 #define SYNC_ENGINE_SYNCER_COMMAND_H_
8 #include "base/basictypes.h"
10 #include "sync/base/sync_export.h"
11 #include "sync/internal_api/public/util/syncer_error.h"
13 namespace syncer {
15 namespace sessions {
16 class SyncSession;
19 // Implementation of a simple command pattern intended to be driven by the
20 // Syncer. SyncerCommand is abstract and all subclasses must implement
21 // ExecuteImpl(). This is done so that chunks of syncer operation can be unit
22 // tested.
24 // Example Usage:
26 // SyncSession session = ...;
27 // SyncerCommand *cmd = SomeCommandFactory.createCommand(...);
28 // cmd->Execute(session);
29 // delete cmd;
31 class SYNC_EXPORT_PRIVATE SyncerCommand {
32 public:
33 SyncerCommand();
34 virtual ~SyncerCommand();
36 // Execute dispatches to a derived class's ExecuteImpl.
37 SyncerError Execute(sessions::SyncSession* session);
39 // ExecuteImpl is where derived classes actually do work.
40 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) = 0;
41 private:
42 DISALLOW_COPY_AND_ASSIGN(SyncerCommand);
45 } // namespace syncer
47 #endif // SYNC_ENGINE_SYNCER_COMMAND_H_