1 // Copyright 2018 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 CHROME_NOTIFICATION_HELPER_COM_SERVER_MODULE_H_
6 #define CHROME_NOTIFICATION_HELPER_COM_SERVER_MODULE_H_
8 #include "base/synchronization/waitable_event.h"
9 #include "base/win/windows_types.h"
11 namespace notification_helper {
13 // This class is used to host the NotificationActivator COM component and serve
14 // as the module for an out-of-proc COM server.
15 class ComServerModule {
20 // Handles object registration and unregistration. Returns when all registered
21 // objects are released.
24 // Registers the NotificationActivator COM object so other applications can
25 // connect to it. Returns the registration status.
26 HRESULT RegisterClassObjects();
28 // Unregisters the NotificationActivator COM object. Returns the
29 // unregistration status.
30 HRESULT UnregisterClassObjects();
32 // Returns the state of the event.
33 bool IsEventSignaled();
36 // Waits for all instance objects are released from the module.
37 void WaitForZeroObjectCount();
39 // Sends out the signal that all objects are now released from the module.
40 void SignalObjectCountZero();
42 // Identifiers of registered class objects. Used for unregistration.
43 DWORD cookies_[1] = {0};
45 // This event starts "unsignaled", and is signaled when the last instance
46 // object is released from the module.
47 base::WaitableEvent object_zero_count_;
49 DISALLOW_COPY_AND_ASSIGN(ComServerModule);
52 } // namespace notification_helper
54 #endif // CHROME_NOTIFICATION_HELPER_COM_SERVER_MODULE_H_