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

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

Issue 1111673003: [chrome/utility] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Review Comments for the pattern Created 5 years, 7 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 | « no previous file | 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 "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/mac/foundation_util.h" 13 #include "base/mac/foundation_util.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/single_thread_task_runner.h"
15 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
16 17
17 namespace image_writer { 18 namespace image_writer {
18 19
19 class ImageWriter; 20 class ImageWriter;
20 21
21 // Manages the unmounting of disks through Disk Arbitration. Disk Arbitration 22 // Manages the unmounting of disks through Disk Arbitration. Disk Arbitration
22 // has to be run on a thread with a CFRunLoop. In the utility process neither 23 // has to be run on a thread with a CFRunLoop. In the utility process neither
23 // the main or IO thread have one by default, so we need to manage a new thread 24 // the main or IO thread have one by default, so we need to manage a new thread
24 // which will explicitly have a CFRunLoop-based message pump. Note that this 25 // which will explicitly have a CFRunLoop-based message pump. Note that this
(...skipping 25 matching lines...) Expand all
50 51
51 // A |MessagePumpFactory| for creating the thread. 52 // A |MessagePumpFactory| for creating the thread.
52 static scoped_ptr<base::MessagePump> CreateMessagePump(); 53 static scoped_ptr<base::MessagePump> CreateMessagePump();
53 54
54 // Starts the unmount process. Should be posted to the |cf_thread_|. 55 // Starts the unmount process. Should be posted to the |cf_thread_|.
55 void UnmountOnWorker(const std::string& device_path); 56 void UnmountOnWorker(const std::string& device_path);
56 57
57 // A convenience method that triggers the failure continuation. 58 // A convenience method that triggers the failure continuation.
58 void Error(); 59 void Error();
59 60
60 scoped_refptr<base::MessageLoopProxy> original_thread_; 61 scoped_refptr<base::SingleThreadTaskRunner> original_thread_;
61 base::Closure success_continuation_; 62 base::Closure success_continuation_;
62 base::Closure failure_continuation_; 63 base::Closure failure_continuation_;
63 64
64 base::ScopedCFTypeRef<DADiskRef> disk_; 65 base::ScopedCFTypeRef<DADiskRef> disk_;
65 base::ScopedCFTypeRef<DASessionRef> session_; 66 base::ScopedCFTypeRef<DASessionRef> session_;
66 67
67 // Thread is last to ensure it is stopped before the data members are 68 // Thread is last to ensure it is stopped before the data members are
68 // destroyed. 69 // destroyed.
69 base::Thread cf_thread_; 70 base::Thread cf_thread_;
70 }; 71 };
71 72
72 } // namespace image_writer 73 } // namespace image_writer
73 74
74 #endif // CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_ 75 #endif // CHROME_UTILITY_IMAGE_WRITER_DISK_UNMOUNTER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/utility/image_writer/disk_unmounter_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698