OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ | 5 #ifndef CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ |
6 #define CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ | 6 #define CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ |
7 | 7 |
8 #include "sync/notifier/invalidation_util.h" | 8 #include "sync/notifier/invalidation_util.h" |
9 | 9 |
10 namespace syncer { | 10 namespace syncer { |
(...skipping 29 matching lines...) Expand all Loading... |
40 // frontend->UnregisterInvalidationHandler(client_handler); | 40 // frontend->UnregisterInvalidationHandler(client_handler); |
41 // | 41 // |
42 // If an invalidation handler cares about the invalidator state, it should also | 42 // If an invalidation handler cares about the invalidator state, it should also |
43 // do the following when starting the client: | 43 // do the following when starting the client: |
44 // | 44 // |
45 // invalidator_state = frontend->GetInvalidatorState(); | 45 // invalidator_state = frontend->GetInvalidatorState(); |
46 // | 46 // |
47 // It can also do the above in OnInvalidatorStateChange(), or it can use the | 47 // It can also do the above in OnInvalidatorStateChange(), or it can use the |
48 // argument to OnInvalidatorStateChange(). | 48 // argument to OnInvalidatorStateChange(). |
49 // | 49 // |
| 50 // It is an error to have registered handlers when an |
| 51 // InvalidationFrontend is shut down; clients must ensure that they |
| 52 // unregister themselves before then. (Depending on the |
| 53 // InvalidationFrontend, shutdown may be equivalent to destruction, or |
| 54 // a separate function call like Shutdown()). |
| 55 // |
50 // NOTE(akalin): Invalidations that come in during browser shutdown may get | 56 // NOTE(akalin): Invalidations that come in during browser shutdown may get |
51 // dropped. This won't matter once we have an Acknowledge API, though: see | 57 // dropped. This won't matter once we have an Acknowledge API, though: see |
52 // http://crbug.com/78462 and http://crbug.com/124149. | 58 // http://crbug.com/78462 and http://crbug.com/124149. |
53 class InvalidationFrontend { | 59 class InvalidationFrontend { |
54 public: | 60 public: |
55 // Starts sending notifications to |handler|. |handler| must not be NULL, | 61 // Starts sending notifications to |handler|. |handler| must not be NULL, |
56 // and it must not already be registered. | 62 // and it must not already be registered. |
57 // | 63 // |
58 // Handler registrations are persisted across restarts of sync. | 64 // Handler registrations are persisted across restarts of sync. |
59 virtual void RegisterInvalidationHandler( | 65 virtual void RegisterInvalidationHandler( |
(...skipping 19 matching lines...) Expand all Loading... |
79 // Returns the current invalidator state. When called from within | 85 // Returns the current invalidator state. When called from within |
80 // InvalidationHandler::OnInvalidatorStateChange(), this must return | 86 // InvalidationHandler::OnInvalidatorStateChange(), this must return |
81 // the updated state. | 87 // the updated state. |
82 virtual syncer::InvalidatorState GetInvalidatorState() const = 0; | 88 virtual syncer::InvalidatorState GetInvalidatorState() const = 0; |
83 | 89 |
84 protected: | 90 protected: |
85 virtual ~InvalidationFrontend() { } | 91 virtual ~InvalidationFrontend() { } |
86 }; | 92 }; |
87 | 93 |
88 #endif // CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ | 94 #endif // CHROME_BROWSER_SYNC_INVALIDATION_FRONTEND_H_ |
OLD | NEW |