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

Side by Side Diff: components/sync_driver/local_device_info_provider_impl.h

Issue 1951703002: [Sync] Clear LocalDeviceInfoProvider cache on sync DB destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move NonThreadSafe to LocalDeviceInfoProviderImpl. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_
6 #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ 6 #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/non_thread_safe.h"
10 #include "components/sync_driver/device_info.h" 11 #include "components/sync_driver/device_info.h"
11 #include "components/sync_driver/local_device_info_provider.h" 12 #include "components/sync_driver/local_device_info_provider.h"
12 #include "components/version_info/version_info.h" 13 #include "components/version_info/version_info.h"
13 14
14 namespace browser_sync { 15 namespace browser_sync {
15 16
16 class LocalDeviceInfoProviderImpl 17 class LocalDeviceInfoProviderImpl
17 : public sync_driver::LocalDeviceInfoProvider { 18 : public sync_driver::LocalDeviceInfoProvider,
19 public base::NonThreadSafe {
18 public: 20 public:
19 LocalDeviceInfoProviderImpl(version_info::Channel channel, 21 LocalDeviceInfoProviderImpl(version_info::Channel channel,
20 const std::string& version, 22 const std::string& version,
21 bool is_tablet); 23 bool is_tablet);
22 ~LocalDeviceInfoProviderImpl() override; 24 ~LocalDeviceInfoProviderImpl() override;
23 25
24 // LocalDeviceInfoProvider implementation. 26 // LocalDeviceInfoProvider implementation.
25 const sync_driver::DeviceInfo* GetLocalDeviceInfo() const override; 27 const sync_driver::DeviceInfo* GetLocalDeviceInfo() const override;
26 std::string GetSyncUserAgent() const override; 28 std::string GetSyncUserAgent() const override;
27 std::string GetLocalSyncCacheGUID() const override; 29 std::string GetLocalSyncCacheGUID() const override;
28 void Initialize( 30 void Initialize(
29 const std::string& cache_guid, 31 const std::string& cache_guid,
30 const std::string& signin_scoped_device_id, 32 const std::string& signin_scoped_device_id,
31 const scoped_refptr<base::TaskRunner>& blocking_task_runner) override; 33 const scoped_refptr<base::TaskRunner>& blocking_task_runner) override;
32 std::unique_ptr<Subscription> RegisterOnInitializedCallback( 34 std::unique_ptr<Subscription> RegisterOnInitializedCallback(
33 const base::Closure& callback) override; 35 const base::Closure& callback) override;
36 void Clear() override;
34 37
35 private: 38 private:
36 void InitializeContinuation(const std::string& guid, 39 void InitializeContinuation(const std::string& guid,
37 const std::string& signin_scoped_device_id, 40 const std::string& signin_scoped_device_id,
38 const std::string& session_name); 41 const std::string& session_name);
39 42
40 // The channel (CANARY, DEV, BETA, etc.) of the current client. 43 // The channel (CANARY, DEV, BETA, etc.) of the current client.
41 const version_info::Channel channel_; 44 const version_info::Channel channel_;
42 45
43 // The version string for the current client. 46 // The version string for the current client.
44 const std::string version_; 47 const std::string version_;
45 48
46 // Whether this device has a tablet form factor (only used on Android 49 // Whether this device has a tablet form factor (only used on Android
47 // devices). 50 // devices).
48 const bool is_tablet_; 51 const bool is_tablet_;
49 52
50 std::string cache_guid_; 53 std::string cache_guid_;
51 std::unique_ptr<sync_driver::DeviceInfo> local_device_info_; 54 std::unique_ptr<sync_driver::DeviceInfo> local_device_info_;
52 base::CallbackList<void(void)> callback_list_; 55 base::CallbackList<void(void)> callback_list_;
53 base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_; 56 base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_;
54 57
55 DISALLOW_COPY_AND_ASSIGN(LocalDeviceInfoProviderImpl); 58 DISALLOW_COPY_AND_ASSIGN(LocalDeviceInfoProviderImpl);
56 }; 59 };
57 60
58 } // namespace browser_sync 61 } // namespace browser_sync
59 62
60 #endif // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ 63 #endif // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_
OLDNEW
« no previous file with comments | « components/sync_driver/local_device_info_provider.h ('k') | components/sync_driver/local_device_info_provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698