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

Side by Side Diff: components/storage_monitor/storage_monitor_mac.mm

Issue 1884743002: Convert a few components from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lint 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
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 "components/storage_monitor/storage_monitor_mac.h" 5 #include "components/storage_monitor/storage_monitor_mac.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 struct EjectDiskOptions { 129 struct EjectDiskOptions {
130 std::string bsd_name; 130 std::string bsd_name;
131 base::Callback<void(StorageMonitor::EjectStatus)> callback; 131 base::Callback<void(StorageMonitor::EjectStatus)> callback;
132 base::ScopedCFTypeRef<DADiskRef> disk; 132 base::ScopedCFTypeRef<DADiskRef> disk;
133 }; 133 };
134 134
135 void PostEjectCallback(DADiskRef disk, 135 void PostEjectCallback(DADiskRef disk,
136 DADissenterRef dissenter, 136 DADissenterRef dissenter,
137 void* context) { 137 void* context) {
138 scoped_ptr<EjectDiskOptions> options_deleter( 138 std::unique_ptr<EjectDiskOptions> options_deleter(
139 static_cast<EjectDiskOptions*>(context)); 139 static_cast<EjectDiskOptions*>(context));
140 if (dissenter) { 140 if (dissenter) {
141 options_deleter->callback.Run(StorageMonitor::EJECT_IN_USE); 141 options_deleter->callback.Run(StorageMonitor::EJECT_IN_USE);
142 return; 142 return;
143 } 143 }
144 144
145 options_deleter->callback.Run(StorageMonitor::EJECT_OK); 145 options_deleter->callback.Run(StorageMonitor::EJECT_OK);
146 } 146 }
147 147
148 void PostUnmountCallback(DADiskRef disk, 148 void PostUnmountCallback(DADiskRef disk,
149 DADissenterRef dissenter, 149 DADissenterRef dissenter,
150 void* context) { 150 void* context) {
151 scoped_ptr<EjectDiskOptions> options_deleter( 151 std::unique_ptr<EjectDiskOptions> options_deleter(
152 static_cast<EjectDiskOptions*>(context)); 152 static_cast<EjectDiskOptions*>(context));
153 if (dissenter) { 153 if (dissenter) {
154 options_deleter->callback.Run(StorageMonitor::EJECT_IN_USE); 154 options_deleter->callback.Run(StorageMonitor::EJECT_IN_USE);
155 return; 155 return;
156 } 156 }
157 157
158 DADiskEject(options_deleter->disk.get(), kDADiskEjectOptionDefault, 158 DADiskEject(options_deleter->disk.get(), kDADiskEjectOptionDefault,
159 PostEjectCallback, options_deleter.release()); 159 PostEjectCallback, options_deleter.release());
160 } 160 }
161 161
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 } 385 }
386 return false; 386 return false;
387 } 387 }
388 388
389 StorageMonitor* StorageMonitor::CreateInternal() { 389 StorageMonitor* StorageMonitor::CreateInternal() {
390 return new StorageMonitorMac(); 390 return new StorageMonitorMac();
391 } 391 }
392 392
393 } // namespace storage_monitor 393 } // namespace storage_monitor
OLDNEW
« no previous file with comments | « components/storage_monitor/storage_monitor_mac.h ('k') | components/storage_monitor/storage_monitor_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698