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

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: 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
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);
hidehiko 2017/02/23 08:36:04 (Not due to this change but) Looks a bug (missing
Shuhei Takahashi 2017/02/23 08:49:30 Great catch! Let's fix it now.
38 } 40 }
39 runner->GetFileSize(url, callback); 41 runner->GetFileSize(url, callback);
40 } 42 }
41 43
42 void OpenFileToReadOnUIThread(const GURL& url, 44 void OpenFileToReadOnUIThread(const GURL& url,
43 const OpenFileToReadCallback& callback) { 45 const OpenFileToReadCallback& callback) {
44 DCHECK_CURRENTLY_ON(BrowserThread::UI); 46 DCHECK_CURRENTLY_ON(BrowserThread::UI);
45 auto* runner = 47 auto* runner =
46 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>(); 48 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
47 if (!runner) { 49 if (!runner) {
50 LOG(ERROR) << "ArcFileSystemOperationRunner unavailable. "
51 << "File system operations are dropped.";
48 callback.Run(mojo::ScopedHandle()); 52 callback.Run(mojo::ScopedHandle());
49 return; 53 return;
50 } 54 }
51 runner->OpenFileToRead(url, callback); 55 runner->OpenFileToRead(url, callback);
52 } 56 }
53 57
54 void GetDocumentOnUIThread(const std::string& authority, 58 void GetDocumentOnUIThread(const std::string& authority,
55 const std::string& document_id, 59 const std::string& document_id,
56 const GetDocumentCallback& callback) { 60 const GetDocumentCallback& callback) {
57 DCHECK_CURRENTLY_ON(BrowserThread::UI); 61 DCHECK_CURRENTLY_ON(BrowserThread::UI);
58 auto* runner = 62 auto* runner =
59 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>(); 63 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
60 if (!runner) { 64 if (!runner) {
65 LOG(ERROR) << "ArcFileSystemOperationRunner unavailable. "
66 << "File system operations are dropped.";
61 callback.Run(mojom::DocumentPtr()); 67 callback.Run(mojom::DocumentPtr());
62 return; 68 return;
63 } 69 }
64 runner->GetDocument(authority, document_id, callback); 70 runner->GetDocument(authority, document_id, callback);
65 } 71 }
66 72
67 void GetChildDocumentsOnUIThread(const std::string& authority, 73 void GetChildDocumentsOnUIThread(const std::string& authority,
68 const std::string& parent_document_id, 74 const std::string& parent_document_id,
69 const GetChildDocumentsCallback& callback) { 75 const GetChildDocumentsCallback& callback) {
70 DCHECK_CURRENTLY_ON(BrowserThread::UI); 76 DCHECK_CURRENTLY_ON(BrowserThread::UI);
71 auto* runner = 77 auto* runner =
72 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>(); 78 ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
73 if (!runner) { 79 if (!runner) {
80 LOG(ERROR) << "ArcFileSystemOperationRunner unavailable. "
81 << "File system operations are dropped.";
74 callback.Run(base::nullopt); 82 callback.Run(base::nullopt);
75 return; 83 return;
76 } 84 }
77 runner->GetChildDocuments(authority, parent_document_id, callback); 85 runner->GetChildDocuments(authority, parent_document_id, callback);
78 } 86 }
79 87
80 } // namespace 88 } // namespace
81 89
82 void GetFileSizeOnIOThread(const GURL& url, 90 void GetFileSizeOnIOThread(const GURL& url,
83 const GetFileSizeCallback& callback) { 91 const GetFileSizeCallback& callback) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 base::Bind( 124 base::Bind(
117 &GetChildDocumentsOnUIThread, authority, parent_document_id, 125 &GetChildDocumentsOnUIThread, authority, parent_document_id,
118 base::Bind( 126 base::Bind(
119 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>, 127 &PostToIOThread<base::Optional<std::vector<mojom::DocumentPtr>>>,
120 callback))); 128 callback)));
121 } 129 }
122 130
123 } // namespace file_system_operation_runner_util 131 } // namespace file_system_operation_runner_util
124 132
125 } // namespace arc 133 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698