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

Side by Side Diff: chrome/utility/image_writer/disk_unmounter_mac.h

Issue 1899083002: Convert //chrome from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 | « chrome/utility/image_decoder_impl.cc ('k') | chrome/utility/image_writer/disk_unmounter_mac.cc » ('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 #ifndef CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_ 5 #ifndef CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_
6 #define CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_ 6 #define CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 #include <DiskArbitration/DiskArbitration.h> 9 #include <DiskArbitration/DiskArbitration.h>
10 10
11 #include <memory>
12
11 #include "base/bind.h" 13 #include "base/bind.h"
12 #include "base/callback.h" 14 #include "base/callback.h"
13 #include "base/mac/foundation_util.h" 15 #include "base/mac/foundation_util.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
17 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
18 19
19 namespace image_writer { 20 namespace image_writer {
20 21
21 class ImageWriter; 22 class ImageWriter;
22 23
23 // Manages the unmounting of disks through Disk Arbitration. Disk Arbitration 24 // Manages the unmounting of disks through Disk Arbitration. Disk Arbitration
24 // has to be run on a thread with a CFRunLoop. In the utility process neither 25 // has to be run on a thread with a CFRunLoop. In the utility process neither
(...skipping 19 matching lines...) Expand all
44 DADissenterRef dissenter, 45 DADissenterRef dissenter,
45 void* context); 46 void* context);
46 // Handles when we fail to claim a disk. 47 // Handles when we fail to claim a disk.
47 static DADissenterRef DiskClaimRevoked(DADiskRef disk, void* context); 48 static DADissenterRef DiskClaimRevoked(DADiskRef disk, void* context);
48 // Handles the disk-unmounted callback. 49 // Handles the disk-unmounted callback.
49 static void DiskUnmounted(DADiskRef disk, 50 static void DiskUnmounted(DADiskRef disk,
50 DADissenterRef dissenter, 51 DADissenterRef dissenter,
51 void* context); 52 void* context);
52 53
53 // A |MessagePumpFactory| for creating the thread. 54 // A |MessagePumpFactory| for creating the thread.
54 static scoped_ptr<base::MessagePump> CreateMessagePump(); 55 static std::unique_ptr<base::MessagePump> CreateMessagePump();
55 56
56 // Starts the unmount process. Should be posted to the |cf_thread_|. 57 // Starts the unmount process. Should be posted to the |cf_thread_|.
57 void UnmountOnWorker(const std::string& device_path); 58 void UnmountOnWorker(const std::string& device_path);
58 59
59 // A convenience method that triggers the failure continuation. 60 // A convenience method that triggers the failure continuation.
60 void Error(); 61 void Error();
61 62
62 scoped_refptr<base::SingleThreadTaskRunner> original_thread_; 63 scoped_refptr<base::SingleThreadTaskRunner> original_thread_;
63 base::Closure success_continuation_; 64 base::Closure success_continuation_;
64 base::Closure failure_continuation_; 65 base::Closure failure_continuation_;
65 66
66 base::ScopedCFTypeRef<DADiskRef> disk_; 67 base::ScopedCFTypeRef<DADiskRef> disk_;
67 base::ScopedCFTypeRef<DASessionRef> session_; 68 base::ScopedCFTypeRef<DASessionRef> session_;
68 69
69 // Thread is last to ensure it is stopped before the data members are 70 // Thread is last to ensure it is stopped before the data members are
70 // destroyed. 71 // destroyed.
71 base::Thread cf_thread_; 72 base::Thread cf_thread_;
72 }; 73 };
73 74
74 } // namespace image_writer 75 } // namespace image_writer
75 76
76 #endif // CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_ 77 #endif // CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_
OLDNEW
« no previous file with comments | « chrome/utility/image_decoder_impl.cc ('k') | chrome/utility/image_writer/disk_unmounter_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698