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

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

Issue 1280513002: Add GenericSharedMemoryId and use w/ GpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trackpools
Patch Set: GenericSharedMemoryId > gfx::GenericSharedMemoryTracingId 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_tracing_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_TRACING_ID_H_
6 #define UI_GFX_GENERIC_SHARED_MEMORY_TRACING_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 accross 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 GenericSharedMemoryTracingId {
17 public:
18 int id;
19
20 // Invalid ID is -1 to match semantics of base::StaticAtomicSequenceNumber.
21 GenericSharedMemoryTracingId() : id(-1) {}
22 explicit GenericSharedMemoryTracingId(int id) : id(id) {}
23 GenericSharedMemoryTracingId(const GenericSharedMemoryTracingId& other) =
24 default;
25 GenericSharedMemoryTracingId& operator=(
26 const GenericSharedMemoryTracingId& other) = default;
27
28 bool operator==(const GenericSharedMemoryTracingId& other) const {
danakj 2015/08/13 00:05:11 Can you make an Equals method instead? Style guide
ericrk 2015/08/13 00:13:56 Need this for hash_map... I could also specialize
danakj 2015/08/13 00:25:06 Oh.. okay.
29 return id == other.id;
30 }
31 };
32
33 // Generates GUID which can be used to trace shared memory using its
34 // GenericSharedMemoryId.
35 BASE_EXPORT base::trace_event::MemoryAllocatorDumpGuid
36 GetGenericSharedMemoryGUIDForTracing(
37 uint64_t tracing_process_id,
38 GenericSharedMemoryTracingId generic_shared_memory_tracing_id);
39
40 } // namespace gfx
41
42 namespace BASE_HASH_NAMESPACE {
43 template <>
44 struct hash<gfx::GenericSharedMemoryTracingId> {
45 size_t operator()(gfx::GenericSharedMemoryTracingId key) const {
46 return BASE_HASH_NAMESPACE::hash<int>()(key.id);
47 }
48 };
49 } // namespace BASE_HASH_NAMESPACE
50
51 #endif // UI_GFX_GENERIC_SHARED_MEMORY_TRACING_ID_H_
OLDNEW
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/generic_shared_memory_tracing_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698