- add sources.
[platform/framework/web/crosswalk.git] / src / components / browser_context_keyed_service / browser_context_keyed_service.h
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVICE_H_
6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVICE_H_
7
8 #include "components/browser_context_keyed_service/browser_context_keyed_service_export.h"
9
10 class BrowserContextKeyedServiceFactory;
11
12 // Base class for all BrowserContextKeyedServices to allow for correct
13 // destruction order.
14 //
15 // Many services that hang off BrowserContext have a two-pass shutdown. Many
16 // subsystems need a first pass shutdown phase where they drop references. Not
17 // all services will need this, so there's a default implementation. Only once
18 // every system has been given a chance to drop references do we start deleting
19 // objects.
20 class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT BrowserContextKeyedService {
21  public:
22   // The first pass is to call Shutdown on a BrowserContextKeyedService.
23   virtual void Shutdown() {}
24
25  protected:
26   friend class BrowserContextKeyedServiceFactory;
27
28   // The second pass is the actual deletion of each object.
29   virtual ~BrowserContextKeyedService() {}
30 };
31
32 #endif  // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVICE_H_