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

Side by Side Diff: chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_util.cc

Issue 2704123007: mediaview: Fix ARC file system operation deferring. (Closed)
Patch Set: Addressed hidehiko's comments. Created 3 years, 10 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/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_u til.h" 5 #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_u til.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h " 10 #include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h "
(...skipping 16 matching lines...) Expand all
27 BrowserThread::IO, FROM_HERE, 27 BrowserThread::IO, FROM_HERE,
28 base::Bind(callback, base::Passed(std::move(result)))); 28 base::Bind(callback, base::Passed(std::move(result))));
29 } 29 }
30 30
31 void GetFileSizeOnUIThread(const GURL& url, 31 void GetFileSizeOnUIThread(const GURL& url,
32 const GetFileSizeCallback& callback) { 32 const GetFileSizeCallback& callback) {
33 DCHECK_CURRENTLY_ON(BrowserThread::UI); 33 DCHECK_CURRENTLY_ON(BrowserThread::UI);
34 auto* runner = 34 auto* runner =
35 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>(); 35 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
36 if (!runner) { 36 if (!runner) {
37 LOG(ERROR) << "ArcFileSystemOperationRunner unavailable. "
38 << "File system operations are dropped.";
37 callback.Run(-1); 39 callback.Run(-1);
40 return;
38 } 41 }
39 runner->GetFileSize(url, callback); 42 runner->GetFileSize(url, callback);
40 } 43 }
41 44
42 void OpenFileToReadOnUIThread(const GURL& url, 45 void OpenFileToReadOnUIThread(const GURL& url,
43 const OpenFileToReadCallback& callback) { 46 const OpenFileToReadCallback& callback) {
44 DCHECK_CURRENTLY_ON(BrowserThread::UI); 47 DCHECK_CURRENTLY_ON(BrowserThread::UI);
45 auto* runner = 48 auto* runner =
46 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>(); 49 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
47 if (!runner) { 50 if (!runner) {
51 LOG(ERROR) << "ArcFileSystemOperationRunner unavailable. "
52 << "File system operations are dropped.";
48 callback.Run(mojo::ScopedHandle()); 53 callback.Run(mojo::ScopedHandle());
49 return; 54 return;
50 } 55 }
51 runner->OpenFileToRead(url, callback); 56 runner->OpenFileToRead(url, callback);
52 } 57 }
53 58
54 void GetDocumentOnUIThread(const std::string& authority, 59 void GetDocumentOnUIThread(const std::string& authority,
55 const std::string& document_id, 60 const std::string& document_id,
56 const GetDocumentCallback& callback) { 61 const GetDocumentCallback& callback) {
57 DCHECK_CURRENTLY_ON(BrowserThread::UI); 62 DCHECK_CURRENTLY_ON(BrowserThread::UI);
58 auto* runner = 63 auto* runner =
59 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>(); 64 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
60 if (!runner) { 65 if (!runner) {
66 LOG(ERROR) << "ArcFileSystemOperationRunner unavailable. "
67 << "File system operations are dropped.";
61 callback.Run(mojom::DocumentPtr()); 68 callback.Run(mojom::DocumentPtr());
62 return; 69 return;
63 } 70 }
64 runner->GetDocument(authority, document_id, callback); 71 runner->GetDocument(authority, document_id, callback);
65 } 72 }
66 73
67 void GetChildDocumentsOnUIThread(const std::string& authority, 74 void GetChildDocumentsOnUIThread(const std::string& authority,
68 const std::string& parent_document_id, 75 const std::string& parent_document_id,
69 const GetChildDocumentsCallback& callback) { 76 const GetChildDocumentsCallback& callback) {
70 DCHECK_CURRENTLY_ON(BrowserThread::UI); 77 DCHECK_CURRENTLY_ON(BrowserThread::UI);
71 auto* runner = 78 auto* runner =
72 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>(); 79 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
73 if (!runner) { 80 if (!runner) {
81 LOG(ERROR) << "ArcFileSystemOperationRunner unavailable. "
82 << "File system operations are dropped.";
74 callback.Run(base::nullopt); 83 callback.Run(base::nullopt);
75 return; 84 return;
76 } 85 }
77 runner->GetChildDocuments(authority, parent_document_id, callback); 86 runner->GetChildDocuments(authority, parent_document_id, callback);
78 } 87 }
79 88
80 } // namespace 89 } // namespace
81 90
82 void GetFileSizeOnIOThread(const GURL& url, 91 void GetFileSizeOnIOThread(const GURL& url,
83 const GetFileSizeCallback& callback) { 92 const GetFileSizeCallback& callback) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 base::Bind( 125 base::Bind(
117 &GetChildDocumentsOnUIThread, authority, parent_document_id, 126 &GetChildDocumentsOnUIThread, authority, parent_document_id,
118 base::Bind( 127 base::Bind(
119 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>, 128 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>,
120 callback))); 129 callback)));
121 } 130 }
122 131
123 } // namespace file_system_operation_runner_util 132 } // namespace file_system_operation_runner_util
124 133
125 } // namespace arc 134 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698