OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // MTPDeviceOperationsUtils provides support to media transfer protocol device |
| 6 // file operation worker classes. |
| 7 |
| 8 #ifndef CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_DEVICE_OPERATIONS_UTILS_H_ |
| 9 #define CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_DEVICE_OPERATIONS_UTILS_H_ |
| 10 |
| 11 #include "base/location.h" |
| 12 #include "base/logging.h" |
| 13 #include "base/sequenced_task_runner.h" |
| 14 #include "base/sequenced_task_runner_helpers.h" |
| 15 #include "base/threading/sequenced_worker_pool.h" |
| 16 |
| 17 namespace chrome { |
| 18 |
| 19 class MediaTransferProtocolManager; |
| 20 |
| 21 // Helper struct to delete worker objects on |media_task_runner_| thread. |
| 22 template <typename WORKER> struct WorkerDeleter { |
| 23 static void Destruct(const WORKER* worker) { |
| 24 if (!worker->media_task_runner()->RunsTasksOnCurrentThread()) { |
| 25 worker->media_task_runner()->DeleteSoon(FROM_HERE, worker); |
| 26 return; |
| 27 } |
| 28 delete worker; |
| 29 } |
| 30 }; |
| 31 |
| 32 // Returns MediaTransferProtocolManager instance on success or NULL on failure. |
| 33 MediaTransferProtocolManager* GetMediaTransferProtocolManager(); |
| 34 |
| 35 } // namespace chrome |
| 36 |
| 37 #endif // CHROME_BROWSER_MEDIA_GALLERY_LINUX_MTP_DEVICE_OPERATIONS_UTILS_H_ |
OLD | NEW |