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

Side by Side Diff: ui/gl/gl_image_shared_memory.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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/gl/gl_image_shared_memory.h ('k') | ui/gl/gl_surface_egl.h » ('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 #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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Minimize the amount of adress space we use but make sure offset is a 54 // Minimize the amount of adress space we use but make sure offset is a
55 // multiple of page size as required by MapAt(). 55 // multiple of page size as required by MapAt().
56 size_t memory_offset = offset % base::SysInfo::VMAllocationGranularity(); 56 size_t memory_offset = offset % base::SysInfo::VMAllocationGranularity();
57 size_t map_offset = base::SysInfo::VMAllocationGranularity() * 57 size_t map_offset = base::SysInfo::VMAllocationGranularity() *
58 (offset / base::SysInfo::VMAllocationGranularity()); 58 (offset / base::SysInfo::VMAllocationGranularity());
59 59
60 checked_size += memory_offset; 60 checked_size += memory_offset;
61 if (!checked_size.IsValid()) 61 if (!checked_size.IsValid())
62 return false; 62 return false;
63 63
64 scoped_ptr<base::SharedMemory> duped_shared_memory( 64 std::unique_ptr<base::SharedMemory> duped_shared_memory(
65 new base::SharedMemory(duped_shared_memory_handle, true)); 65 new base::SharedMemory(duped_shared_memory_handle, true));
66 if (!duped_shared_memory->MapAt(static_cast<off_t>(map_offset), 66 if (!duped_shared_memory->MapAt(static_cast<off_t>(map_offset),
67 checked_size.ValueOrDie())) { 67 checked_size.ValueOrDie())) {
68 DVLOG(0) << "Failed to map shared memory."; 68 DVLOG(0) << "Failed to map shared memory.";
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)) {
(...skipping 28 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « ui/gl/gl_image_shared_memory.h ('k') | ui/gl/gl_surface_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698