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

Unified Diff: sync/test/engine/injectable_sync_context_proxy.h

Issue 351523003: sync: Mass rename of non-blocking sync classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const ref some smart pointers Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/sync_tests.gypi ('k') | sync/test/engine/injectable_sync_context_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/test/engine/injectable_sync_context_proxy.h
diff --git a/sync/test/engine/injectable_sync_context_proxy.h b/sync/test/engine/injectable_sync_context_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..7c9f48dc5fedb083ca5a0e6a4f454a7cd981a6d2
--- /dev/null
+++ b/sync/test/engine/injectable_sync_context_proxy.h
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_TEST_ENGINE_INJECTABLE_SYNC_CONTEXT_PROXY_H_
+#define SYNC_TEST_ENGINE_INJECTABLE_SYNC_CONTEXT_PROXY_H_
+
+#include "sync/internal_api/public/base/model_type.h"
+#include "sync/internal_api/public/sync_context_proxy.h"
+
+namespace syncer {
+
+struct DataTypeState;
+class ModelTypeSyncProxyImpl;
+class ModelTypeSyncWorker;
+
+// A SyncContextProxy implementation that, when a connection request is made,
+// initalizes a connection to a previously injected ModelTypeSyncProxyImpl.
+class InjectableSyncContextProxy : public syncer::SyncContextProxy {
+ public:
+ explicit InjectableSyncContextProxy(ModelTypeSyncWorker* worker);
+ virtual ~InjectableSyncContextProxy();
+
+ virtual void ConnectTypeToSync(
+ syncer::ModelType type,
+ const DataTypeState& data_type_state,
+ const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_sync_proxy)
+ OVERRIDE;
+ virtual void Disconnect(syncer::ModelType type) OVERRIDE;
+ virtual scoped_ptr<SyncContextProxy> Clone() const OVERRIDE;
+
+ ModelTypeSyncWorker* GetWorker();
+
+ private:
+ // A flag to ensure ConnectTypeToSync is called at most once.
+ bool is_worker_connected_;
+
+ // The ModelTypeSyncProxy's contract expects that it gets to own this object,
+ // so we can retain only a non-owned pointer to it.
+ //
+ // This is very unsafe, but we can get away with it since these tests are not
+ // exercising the proxy <-> worker connection code.
+ ModelTypeSyncWorker* worker_;
+};
+
+} // namespace syncer
+
+#endif // SYNC_TEST_ENGINE_INJECTABLE_SYNC_CONTEXT_PROXY_H_
« no previous file with comments | « sync/sync_tests.gypi ('k') | sync/test/engine/injectable_sync_context_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698