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

Side by Side Diff: mojo/common/environment_data.h

Issue 218583009: Adds a way to associate key/value pairs with the environment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make mojo_service_manager depend on mojo_common_lib Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/app/mojo/mojo_init.cc ('k') | mojo/common/environment_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_COMMON_ENVIRONMENT_DATA_H_
6 #define MOJO_COMMON_ENVIRONMENT_DATA_H_
7
8 #include <map>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/synchronization/lock.h"
12 #include "mojo/common/mojo_common_export.h"
13
14 namespace mojo {
15 namespace common {
16
17 // EnvironmentData is used to store arbitrary key/value pairs in the
18 // environment. The key/value pairs are owned by the Environment and deleted
19 // when it is deleted.
20 class MOJO_COMMON_EXPORT EnvironmentData {
21 public:
22 class MOJO_COMMON_EXPORT Data {
23 public:
24 Data() {}
25 virtual ~Data() {}
26 };
27
28 EnvironmentData();
29 ~EnvironmentData();
30
31 static EnvironmentData* GetInstance();
32
33 void SetData(const void* key, scoped_ptr<Data> data);
34
35 Data* GetData(const void* key);
36
37 private:
38 typedef std::map<const void*, Data*> DataMap;
39
40 static EnvironmentData* instance_;
41
42 base::Lock data_lock_;
43
44 DataMap data_map_;
45
46 DISALLOW_COPY_AND_ASSIGN(EnvironmentData);
47 };
48
49 } // namespace common
50 } // namespace mojo
51
52 #endif // MOJO_COMMON_ENVIRONMENT_DATA_H_
OLDNEW
« no previous file with comments | « content/app/mojo/mojo_init.cc ('k') | mojo/common/environment_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698