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

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

Issue 623883002: Revert "Move mojo edk into mojo/edk" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.cc ('k') | mojo/edk/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
(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_EDK_SYSTEM_MAPPING_TABLE_H_
6 #define MOJO_EDK_SYSTEM_MAPPING_TABLE_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "base/containers/hash_tables.h"
13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "mojo/edk/system/system_impl_export.h"
16 #include "mojo/public/c/system/types.h"
17
18 namespace mojo {
19
20 namespace embedder {
21 class PlatformSharedBufferMapping;
22 }
23
24 namespace system {
25
26 class Core;
27
28 // Test-only function (defined/used in embedder/test_embedder.cc). Declared here
29 // so it can be friended.
30 namespace internal {
31 bool ShutdownCheckNoLeaks(Core*);
32 }
33
34 // This class provides the (global) table of memory mappings (owned by |Core|),
35 // which maps mapping base addresses to |PlatformSharedBufferMapping|s.
36 //
37 // This class is NOT thread-safe; locking is left to |Core|.
38 class MOJO_SYSTEM_IMPL_EXPORT MappingTable {
39 public:
40 MappingTable();
41 ~MappingTable();
42
43 // Tries to add a mapping. (Takes ownership of the mapping in all cases; on
44 // failure, it will be destroyed.)
45 MojoResult AddMapping(
46 scoped_ptr<embedder::PlatformSharedBufferMapping> mapping);
47 MojoResult RemoveMapping(uintptr_t address);
48
49 private:
50 friend bool internal::ShutdownCheckNoLeaks(Core*);
51
52 typedef base::hash_map<uintptr_t, embedder::PlatformSharedBufferMapping*>
53 AddressToMappingMap;
54 AddressToMappingMap address_to_mapping_map_;
55
56 DISALLOW_COPY_AND_ASSIGN(MappingTable);
57 };
58
59 } // namespace system
60 } // namespace mojo
61
62 #endif // MOJO_EDK_SYSTEM_MAPPING_TABLE_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.cc ('k') | mojo/edk/system/mapping_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698