|
@@ -25,15 +25,15 @@ namespace Plugin {
|
|
|
25
25
|
|
|
26
26
|
namespace {
|
|
27
27
|
|
|
28
|
-
static Metadata<InProcessPreconditions>metadata(
|
|
28
|
+
static Metadata<InProcessPreconditions> metadata(
|
|
29
29
|
// Version
|
|
30
30
|
1, 0, 0,
|
|
31
31
|
// Preconditions
|
|
32
|
-
{ subsystem::GRAPHICS },
|
|
32
|
+
{ subsystem::GRAPHICS , subsystem::NOT_GRAPHICS , subsystem::TIME },
|
|
33
33
|
// Terminations
|
|
34
|
-
{
|
|
34
|
+
{},
|
|
35
35
|
// Controls
|
|
36
|
-
{
|
|
36
|
+
{}
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -53,10 +53,33 @@ namespace Plugin {
|
|
|
53
53
|
return (string());
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
Core::hresult InProcessPreconditions::Register(INotification*
|
|
56
|
+
Core::hresult InProcessPreconditions::Register(Exchange::ITimeSync::INotification* notification) {
|
|
57
|
+
ASSERT(notification != nullptr);
|
|
58
|
+
|
|
59
|
+
_adminLock.Lock();
|
|
60
|
+
auto item = std::find(_timesyncNotification.begin(), _timesyncNotification.end(), notification);
|
|
61
|
+
ASSERT(item == _timesyncNotification.end());
|
|
62
|
+
|
|
63
|
+
if (item == _timesyncNotification.end()) {
|
|
64
|
+
notification->AddRef();
|
|
65
|
+
_timesyncNotification.push_back(notification);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_adminLock.Unlock();
|
|
57
69
|
return Core::ERROR_NONE;
|
|
58
70
|
}
|
|
59
|
-
Core::hresult InProcessPreconditions::Unregister(const INotification*
|
|
71
|
+
Core::hresult InProcessPreconditions::Unregister(const Exchange::ITimeSync::INotification* notification) {
|
|
72
|
+
ASSERT(notification != nullptr);
|
|
73
|
+
|
|
74
|
+
_adminLock.Lock();
|
|
75
|
+
auto item = std::find(_timesyncNotification.begin(), _timesyncNotification.end(), notification);
|
|
76
|
+
ASSERT(item != _timesyncNotification.end());
|
|
77
|
+
|
|
78
|
+
if (item != _timesyncNotification.end()) {
|
|
79
|
+
_timesyncNotification.erase(item);
|
|
80
|
+
notification->Release();
|
|
81
|
+
}
|
|
82
|
+
_adminLock.Unlock();
|
|
60
83
|
return Core::ERROR_NONE;
|
|
61
84
|
}
|
|
62
85
|
Core::hresult InProcessPreconditions::Synchronize() {
|
|
@@ -71,5 +94,21 @@ namespace Plugin {
|
|
|
71
94
|
Core::hresult InProcessPreconditions::Time(const Core::Time& /* time */) {
|
|
72
95
|
return Core::ERROR_NONE;
|
|
73
96
|
}
|
|
97
|
+
|
|
98
|
+
void InProcessPreconditions::NotifyTimeChanged() const {
|
|
99
|
+
_adminLock.Lock();
|
|
100
|
+
for (auto* notification : _timesyncNotification) {
|
|
101
|
+
notification->TimeChanged();
|
|
102
|
+
}
|
|
103
|
+
_adminLock.Unlock();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
void InProcessPreconditions::NotifyCompleted() const {
|
|
107
|
+
_adminLock.Lock();
|
|
108
|
+
for (auto* notification : _timesyncNotification) {
|
|
109
|
+
notification->Completed();
|
|
110
|
+
}
|
|
111
|
+
_adminLock.Unlock();
|
|
112
|
+
}
|
|
74
113
|
} // Plugin
|
|
75
114
|
} // Thunder
|
|
@@ -42,8 +42,6 @@ namespace Plugin {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
~InProcessPreconditions() override = default;
|
|
45
|
-
private:
|
|
46
|
-
public:
|
|
47
45
|
// IPlugin Methods
|
|
48
46
|
const string Initialize(PluginHost::IShell* service) override;
|
|
49
47
|
void Deinitialize(PluginHost::IShell* service) override;
|
|
@@ -72,6 +70,9 @@ namespace Plugin {
|
|
|
72
70
|
private:
|
|
73
71
|
using TimeSyncNotificationContainer = std::vector<Exchange::ITimeSync::INotification*>;
|
|
74
72
|
|
|
73
|
+
void NotifyTimeChanged() const;
|
|
74
|
+
void NotifyCompleted() const;
|
|
75
|
+
|
|
75
76
|
mutable Core::CriticalSection _adminLock;
|
|
76
77
|
TimeSyncNotificationContainer _timesyncNotification;
|
|
77
78
|
};
|