OLD | NEW |
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 #include "ui/gl/gl_image_shared_memory.h" | 5 #include "ui/gl/gl_image_shared_memory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/numerics/safe_math.h" | 9 #include "base/numerics/safe_math.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return false; | 69 return false; |
70 } | 70 } |
71 | 71 |
72 if (!GLImageMemory::Initialize( | 72 if (!GLImageMemory::Initialize( |
73 static_cast<uint8_t*>(duped_shared_memory->memory()) + memory_offset, | 73 static_cast<uint8_t*>(duped_shared_memory->memory()) + memory_offset, |
74 format, stride)) { | 74 format, stride)) { |
75 return false; | 75 return false; |
76 } | 76 } |
77 | 77 |
78 DCHECK(!shared_memory_); | 78 DCHECK(!shared_memory_); |
79 shared_memory_ = duped_shared_memory.Pass(); | 79 shared_memory_ = std::move(duped_shared_memory); |
80 shared_memory_id_ = shared_memory_id; | 80 shared_memory_id_ = shared_memory_id; |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 void GLImageSharedMemory::Destroy(bool have_context) { | 84 void GLImageSharedMemory::Destroy(bool have_context) { |
85 GLImageMemory::Destroy(have_context); | 85 GLImageMemory::Destroy(have_context); |
86 shared_memory_.reset(); | 86 shared_memory_.reset(); |
87 } | 87 } |
88 | 88 |
89 void GLImageSharedMemory::OnMemoryDump( | 89 void GLImageSharedMemory::OnMemoryDump( |
(...skipping 13 matching lines...) Expand all Loading... |
103 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 103 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
104 static_cast<uint64_t>(size_in_bytes)); | 104 static_cast<uint64_t>(size_in_bytes)); |
105 | 105 |
106 auto guid = GetGenericSharedMemoryGUIDForTracing(process_tracing_id, | 106 auto guid = GetGenericSharedMemoryGUIDForTracing(process_tracing_id, |
107 shared_memory_id_); | 107 shared_memory_id_); |
108 pmd->CreateSharedGlobalAllocatorDump(guid); | 108 pmd->CreateSharedGlobalAllocatorDump(guid); |
109 pmd->AddOwnershipEdge(dump->guid(), guid); | 109 pmd->AddOwnershipEdge(dump->guid(), guid); |
110 } | 110 } |
111 | 111 |
112 } // namespace gl | 112 } // namespace gl |
OLD | NEW |