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

Side by Side Diff: ui/gfx/generic_shared_memory_id.h

Issue 1280513002: Add GenericSharedMemoryId and use w/ GpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trackpools
Patch Set: remove "tracing" from name Created 5 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
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/generic_shared_memory_id.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 2015 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 UI_GFX_GENERIC_SHARED_MEMORY_ID_H_
6 #define UI_GFX_GENERIC_SHARED_MEMORY_ID_H_
7
8 #include "base/trace_event/memory_allocator_dump.h"
9 #include "ui/gfx/gfx_export.h"
10
11 namespace gfx {
12
13 // Defines an ID type which is used across all types of shared memory
14 // allocations in content/. This ID type is in ui/gfx, as components outside
15 // content/ may need to hold an ID (but should not generate one).
16 class GFX_EXPORT GenericSharedMemoryId {
17 public:
18 int id;
19
20 // Invalid ID is -1 to match semantics of base::StaticAtomicSequenceNumber.
21 GenericSharedMemoryId() : id(-1) {}
22 explicit GenericSharedMemoryId(int id) : id(id) {}
23 GenericSharedMemoryId(const GenericSharedMemoryId& other) = default;
24 GenericSharedMemoryId& operator=(const GenericSharedMemoryId& other) =
25 default;
26
27 bool operator==(const GenericSharedMemoryId& other) const {
28 return id == other.id;
29 }
30
31 bool operator<(const GenericSharedMemoryId& other) const {
32 return id < other.id;
33 }
34 };
35
36 // Generates GUID which can be used to trace shared memory using its
37 // GenericSharedMemoryId.
38 GFX_EXPORT base::trace_event::MemoryAllocatorDumpGuid
39 GetGenericSharedMemoryGUIDForTracing(
40 uint64_t tracing_process_id,
41 GenericSharedMemoryId generic_shared_memory_id);
42
43 } // namespace gfx
44
45 namespace BASE_HASH_NAMESPACE {
46 template <>
47 struct hash<gfx::GenericSharedMemoryId> {
48 size_t operator()(gfx::GenericSharedMemoryId key) const {
49 return BASE_HASH_NAMESPACE::hash<int>()(key.id);
50 }
51 };
52 } // namespace BASE_HASH_NAMESPACE
53
54 #endif // UI_GFX_GENERIC_SHARED_MEMORY_ID_H_
OLDNEW
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/generic_shared_memory_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698