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

Side by Side Diff: components/leveldb/leveldb_mojo_proxy.cc

Issue 2592623002: mojo:: Introduce InterfaceRequest ctor that takes in InterfacePtr* (Closed)
Patch Set: Rebase + response to review Created 3 years, 12 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 "components/leveldb/leveldb_mojo_proxy.h" 5 #include "components/leveldb/leveldb_mojo_proxy.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 bool completed = dir->directory->Exists(name, &error, exists); 219 bool completed = dir->directory->Exists(name, &error, exists);
220 DCHECK(completed); 220 DCHECK(completed);
221 } 221 }
222 222
223 void LevelDBMojoProxy::GetChildrenImpl( 223 void LevelDBMojoProxy::GetChildrenImpl(
224 OpaqueDir* dir, 224 OpaqueDir* dir,
225 std::string name, 225 std::string name,
226 std::vector<std::string>* out_contents, 226 std::vector<std::string>* out_contents,
227 filesystem::mojom::FileError* out_error) { 227 filesystem::mojom::FileError* out_error) {
228 filesystem::mojom::DirectoryPtr target; 228 filesystem::mojom::DirectoryPtr target;
229 filesystem::mojom::DirectoryRequest proxy = MakeRequest(&target); 229 filesystem::mojom::DirectoryRequest proxy(&target);
230 bool completed = dir->directory->OpenDirectory( 230 bool completed = dir->directory->OpenDirectory(
231 name, std::move(proxy), 231 name, std::move(proxy),
232 filesystem::mojom::kFlagRead | filesystem::mojom::kFlagWrite, out_error); 232 filesystem::mojom::kFlagRead | filesystem::mojom::kFlagWrite, out_error);
233 DCHECK(completed); 233 DCHECK(completed);
234 234
235 if (*out_error != filesystem::mojom::FileError::OK) 235 if (*out_error != filesystem::mojom::FileError::OK)
236 return; 236 return;
237 237
238 base::Optional<std::vector<filesystem::mojom::DirectoryEntryPtr>> 238 base::Optional<std::vector<filesystem::mojom::DirectoryEntryPtr>>
239 directory_contents; 239 directory_contents;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 DCHECK(completed); 285 DCHECK(completed);
286 } 286 }
287 287
288 void LevelDBMojoProxy::LockFileImpl(OpaqueDir* dir, 288 void LevelDBMojoProxy::LockFileImpl(OpaqueDir* dir,
289 const std::string& path, 289 const std::string& path,
290 filesystem::mojom::FileError* out_error, 290 filesystem::mojom::FileError* out_error,
291 OpaqueLock** out_lock) { 291 OpaqueLock** out_lock) {
292 // Since a lock is associated with a file descriptor, we need to open and 292 // Since a lock is associated with a file descriptor, we need to open and
293 // have a persistent file on the other side of the connection. 293 // have a persistent file on the other side of the connection.
294 filesystem::mojom::FilePtr target; 294 filesystem::mojom::FilePtr target;
295 filesystem::mojom::FileRequest proxy = MakeRequest(&target); 295 filesystem::mojom::FileRequest proxy(&target);
296 bool completed = dir->directory->OpenFile(path, std::move(proxy), 296 bool completed = dir->directory->OpenFile(path, std::move(proxy),
297 filesystem::mojom::kFlagOpenAlways | 297 filesystem::mojom::kFlagOpenAlways |
298 filesystem::mojom::kFlagRead | 298 filesystem::mojom::kFlagRead |
299 filesystem::mojom::kFlagWrite, 299 filesystem::mojom::kFlagWrite,
300 out_error); 300 out_error);
301 DCHECK(completed); 301 DCHECK(completed);
302 302
303 if (*out_error != filesystem::mojom::FileError::OK) 303 if (*out_error != filesystem::mojom::FileError::OK)
304 return; 304 return;
305 305
306 completed = target->Lock(out_error); 306 completed = target->Lock(out_error);
307 DCHECK(completed); 307 DCHECK(completed);
308 308
309 if (*out_error == filesystem::mojom::FileError::OK) { 309 if (*out_error == filesystem::mojom::FileError::OK) {
310 OpaqueLock* l = new OpaqueLock; 310 OpaqueLock* l = new OpaqueLock;
311 l->lock_file = std::move(target); 311 l->lock_file = std::move(target);
312 *out_lock = l; 312 *out_lock = l;
313 } 313 }
314 } 314 }
315 315
316 void LevelDBMojoProxy::UnlockFileImpl(std::unique_ptr<OpaqueLock> lock, 316 void LevelDBMojoProxy::UnlockFileImpl(std::unique_ptr<OpaqueLock> lock,
317 filesystem::mojom::FileError* out_error) { 317 filesystem::mojom::FileError* out_error) {
318 lock->lock_file->Unlock(out_error); 318 lock->lock_file->Unlock(out_error);
319 } 319 }
320 320
321 } // namespace leveldb 321 } // namespace leveldb
OLDNEW
« no previous file with comments | « components/exo/surface.cc ('k') | components/password_manager/content/browser/content_password_manager_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698