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

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

Issue 471773002: Mojo: Add a platform interface for shared memory (embedder::PlatformSharedBuffer). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 6 years, 4 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 | « mojo/system/dispatcher_unittest.cc ('k') | mojo/system/mapping_table.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/types.h" 15 #include "mojo/public/c/system/types.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
20 namespace embedder {
21 class PlatformSharedBufferMapping;
22 }
23
19 namespace system { 24 namespace system {
20 25
21 class Core; 26 class Core;
22 class RawSharedBufferMapping;
23 27
24 // Test-only function (defined/used in embedder/test_embedder.cc). Declared here 28 // Test-only function (defined/used in embedder/test_embedder.cc). Declared here
25 // so it can be friended. 29 // so it can be friended.
26 namespace internal { 30 namespace internal {
27 bool ShutdownCheckNoLeaks(Core*); 31 bool ShutdownCheckNoLeaks(Core*);
28 } 32 }
29 33
30 // This class provides the (global) table of memory mappings (owned by |Core|), 34 // This class provides the (global) table of memory mappings (owned by |Core|),
31 // which maps mapping base addresses to |RawSharedBuffer::Mapping|s. 35 // which maps mapping base addresses to |PlatformSharedBufferMapping|s.
32 // 36 //
33 // This class is NOT thread-safe; locking is left to |Core|. 37 // This class is NOT thread-safe; locking is left to |Core|.
34 class MOJO_SYSTEM_IMPL_EXPORT MappingTable { 38 class MOJO_SYSTEM_IMPL_EXPORT MappingTable {
35 public: 39 public:
36 MappingTable(); 40 MappingTable();
37 ~MappingTable(); 41 ~MappingTable();
38 42
39 // Tries to add a mapping. (Takes ownership of the mapping in all cases; on 43 // Tries to add a mapping. (Takes ownership of the mapping in all cases; on
40 // failure, it will be destroyed.) 44 // failure, it will be destroyed.)
41 MojoResult AddMapping(scoped_ptr<RawSharedBufferMapping> mapping); 45 MojoResult AddMapping(
46 scoped_ptr<embedder::PlatformSharedBufferMapping> mapping);
42 MojoResult RemoveMapping(uintptr_t address); 47 MojoResult RemoveMapping(uintptr_t address);
43 48
44 private: 49 private:
45 friend bool internal::ShutdownCheckNoLeaks(Core*); 50 friend bool internal::ShutdownCheckNoLeaks(Core*);
46 51
47 typedef base::hash_map<uintptr_t, RawSharedBufferMapping*> 52 typedef base::hash_map<uintptr_t, embedder::PlatformSharedBufferMapping*>
48 AddressToMappingMap; 53 AddressToMappingMap;
49 AddressToMappingMap address_to_mapping_map_; 54 AddressToMappingMap address_to_mapping_map_;
50 55
51 DISALLOW_COPY_AND_ASSIGN(MappingTable); 56 DISALLOW_COPY_AND_ASSIGN(MappingTable);
52 }; 57 };
53 58
54 } // namespace system 59 } // namespace system
55 } // namespace mojo 60 } // namespace mojo
56 61
57 #endif // MOJO_SYSTEM_MAPPING_TABLE_H_ 62 #endif // MOJO_SYSTEM_MAPPING_TABLE_H_
OLDNEW
« no previous file with comments | « mojo/system/dispatcher_unittest.cc ('k') | mojo/system/mapping_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698