Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / sync / internal_api / sync_core_proxy_impl.h
blob99e1b8f14aa81000e6f1579fb5e193366f5f865e
1 // Copyright 2014 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_INTERNAL_API_SYNC_CORE_PROXY_IMPL_H_
6 #define SYNC_INTERNAL_API_SYNC_CORE_PROXY_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/sequenced_task_runner.h"
11 #include "sync/base/sync_export.h"
12 #include "sync/internal_api/public/base/model_type.h"
13 #include "sync/internal_api/public/sync_core_proxy.h"
15 namespace syncer {
17 class SyncCore;
18 class NonBlockingTypeProcessor;
20 // Encapsulates a reference to the sync core and the thread it's running on.
21 // Used by sync's data types to connect with the sync core.
23 // It is epxected that this object will be copied to and used on many different
24 // threads. It is small and safe to pass by value.
25 class SYNC_EXPORT_PRIVATE SyncCoreProxyImpl : public SyncCoreProxy {
26 public:
27 SyncCoreProxyImpl(
28 scoped_refptr<base::SequencedTaskRunner> sync_task_runner,
29 base::WeakPtr<SyncCore> sync_core);
30 virtual ~SyncCoreProxyImpl();
32 // Attempts to connect a non-blocking type to the sync core.
34 // This may fail under some unusual circumstances, like shutdown. Due to the
35 // nature of WeakPtrs and cross-thread communication, the caller will be
36 // unable to distinguish a slow success from failure.
38 // Must be called from the thread where the data type lives.
39 virtual void ConnectTypeToCore(
40 syncer::ModelType type,
41 base::WeakPtr<NonBlockingTypeProcessor> type_processor) OVERRIDE;
43 virtual scoped_ptr<SyncCoreProxy> Clone() const OVERRIDE;
45 private:
46 // A SequencedTaskRunner representing the thread where the SyncCore lives.
47 scoped_refptr<base::SequencedTaskRunner> sync_task_runner_;
49 // The SyncCore this object is wrapping.
50 base::WeakPtr<SyncCore> sync_core_;
53 } // namespace syncer
55 #endif // SYNC_INTERNAL_API_SYNC_CORE_PROXY_IMPL_H_