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

Side by Side Diff: components/filesystem/file_impl.cc

Issue 1737933002: mojo leveldb: Get profile and leveldb connected to DOMStorageContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge tot Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/filesystem/file_impl.h" 5 #include "components/filesystem/file_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 16 matching lines...) Expand all
27 namespace filesystem { 27 namespace filesystem {
28 namespace { 28 namespace {
29 29
30 const size_t kMaxReadSize = 1 * 1024 * 1024; // 1 MB. 30 const size_t kMaxReadSize = 1 * 1024 * 1024; // 1 MB.
31 31
32 } // namespace 32 } // namespace
33 33
34 FileImpl::FileImpl(mojo::InterfaceRequest<File> request, 34 FileImpl::FileImpl(mojo::InterfaceRequest<File> request,
35 const base::FilePath& path, 35 const base::FilePath& path,
36 uint32_t flags, 36 uint32_t flags,
37 LockTable* lock_table) 37 scoped_refptr<LockTable> lock_table)
38 : binding_(this, std::move(request)), 38 : binding_(this, std::move(request)),
39 file_(path, flags), 39 file_(path, flags),
40 path_(path), 40 path_(path),
41 lock_table_(lock_table) { 41 lock_table_(std::move(lock_table)) {
42 DCHECK(file_.IsValid()); 42 DCHECK(file_.IsValid());
43 } 43 }
44 44
45 FileImpl::FileImpl(mojo::InterfaceRequest<File> request, 45 FileImpl::FileImpl(mojo::InterfaceRequest<File> request,
46 const base::FilePath& path, 46 const base::FilePath& path,
47 base::File file, 47 base::File file,
48 LockTable* lock_table) 48 scoped_refptr<LockTable> lock_table)
49 : binding_(this, std::move(request)), 49 : binding_(this, std::move(request)),
50 file_(std::move(file)), 50 file_(std::move(file)),
51 path_(path), 51 path_(path),
52 lock_table_(lock_table) { 52 lock_table_(std::move(lock_table)) {
53 DCHECK(file_.IsValid()); 53 DCHECK(file_.IsValid());
54 } 54 }
55 55
56 FileImpl::~FileImpl() { 56 FileImpl::~FileImpl() {
57 if (file_.IsValid()) 57 if (file_.IsValid())
58 lock_table_->RemoveFromLockTable(path_); 58 lock_table_->RemoveFromLockTable(path_);
59 } 59 }
60 60
61 bool FileImpl::IsValid() const { 61 bool FileImpl::IsValid() const {
62 return file_.IsValid(); 62 return file_.IsValid();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 new_file.TakePlatformFile(), &mojo_handle); 352 new_file.TakePlatformFile(), &mojo_handle);
353 if (create_result != MOJO_RESULT_OK) { 353 if (create_result != MOJO_RESULT_OK) {
354 callback.Run(FileError::FAILED, ScopedHandle()); 354 callback.Run(FileError::FAILED, ScopedHandle());
355 return; 355 return;
356 } 356 }
357 357
358 callback.Run(FileError::OK, ScopedHandle(mojo::Handle(mojo_handle))); 358 callback.Run(FileError::OK, ScopedHandle(mojo::Handle(mojo_handle)));
359 } 359 }
360 360
361 } // namespace filesystem 361 } // namespace filesystem
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698