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

Side by Side Diff: mojo/system/mapping_table.h

Issue 231353002: Make mojo_system static and mojo_system_impl a component, never use both (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 MOJO_SYSTEM_MAPPING_TABLE_H_ 5 #ifndef MOJO_SYSTEM_MAPPING_TABLE_H_
6 #define MOJO_SYSTEM_MAPPING_TABLE_H_ 6 #define MOJO_SYSTEM_MAPPING_TABLE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "mojo/public/c/system/core.h" 15 #include "mojo/public/c/system/core.h"
16 #include "mojo/system/system_impl_export.h" 16 #include "mojo/system/system_impl_export.h"
17 17
18 namespace mojo { 18 namespace mojo {
19 namespace system { 19 namespace system {
20 20
21 class CoreImpl; 21 class Core;
22 class RawSharedBufferMapping; 22 class RawSharedBufferMapping;
23 23
24 // Test-only function (defined/used in embedder/test_embedder.cc). Declared here 24 // Test-only function (defined/used in embedder/test_embedder.cc). Declared here
25 // so it can be friended. 25 // so it can be friended.
26 namespace internal { 26 namespace internal {
27 bool ShutdownCheckNoLeaks(CoreImpl*); 27 bool ShutdownCheckNoLeaks(Core*);
28 } 28 }
29 29
30 // This class provides the (global) table of memory mappings (owned by 30 // This class provides the (global) table of memory mappings (owned by
viettrungluu 2014/04/09 20:26:52 Nit: Re-wrap.
DaveMoore 2014/04/09 22:49:08 Done.
31 // |CoreImpl|), which maps mapping base addresses to 31 // |Core|), which maps mapping base addresses to
32 // |RawSharedBuffer::Mapping|s. 32 // |RawSharedBuffer::Mapping|s.
33 // 33 //
34 // This class is NOT thread-safe; locking is left to |CoreImpl|. 34 // This class is NOT thread-safe; locking is left to |Core|.
35 class MOJO_SYSTEM_IMPL_EXPORT MappingTable { 35 class MOJO_SYSTEM_IMPL_EXPORT MappingTable {
36 public: 36 public:
37 MappingTable(); 37 MappingTable();
38 ~MappingTable(); 38 ~MappingTable();
39 39
40 // Tries to add a mapping. (Takes ownership of the mapping in all cases; on 40 // Tries to add a mapping. (Takes ownership of the mapping in all cases; on
41 // failure, it will be destroyed.) 41 // failure, it will be destroyed.)
42 MojoResult AddMapping(scoped_ptr<RawSharedBufferMapping> mapping); 42 MojoResult AddMapping(scoped_ptr<RawSharedBufferMapping> mapping);
43 MojoResult RemoveMapping(void* address); 43 MojoResult RemoveMapping(void* address);
44 44
45 private: 45 private:
46 friend bool internal::ShutdownCheckNoLeaks(CoreImpl*); 46 friend bool internal::ShutdownCheckNoLeaks(Core*);
47 47
48 typedef base::hash_map<uintptr_t, RawSharedBufferMapping*> 48 typedef base::hash_map<uintptr_t, RawSharedBufferMapping*>
49 AddressToMappingMap; 49 AddressToMappingMap;
50 AddressToMappingMap address_to_mapping_map_; 50 AddressToMappingMap address_to_mapping_map_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(MappingTable); 52 DISALLOW_COPY_AND_ASSIGN(MappingTable);
53 }; 53 };
54 54
55 } // namespace system 55 } // namespace system
56 } // namespace mojo 56 } // namespace mojo
57 57
58 #endif // MOJO_SYSTEM_MAPPING_TABLE_H_ 58 #endif // MOJO_SYSTEM_MAPPING_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698