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

Side by Side Diff: chrome/browser/sync_file_system/local/root_delete_helper.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sync_file_system/local/root_delete_helper.h" 5 #include "chrome/browser/sync_file_system/local/root_delete_helper.h"
6 6
7 #include "base/sequenced_task_runner.h" 7 #include "base/sequenced_task_runner.h"
8 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" 8 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h"
9 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" 9 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
10 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" 10 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Ignore errors, no idea how to deal with it. 69 // Ignore errors, no idea how to deal with it.
70 70
71 DCHECK(!sync_status_->IsWritable(url_)); 71 DCHECK(!sync_status_->IsWritable(url_));
72 DCHECK(!sync_status_->IsWriting(url_)); 72 DCHECK(!sync_status_->IsWriting(url_));
73 73
74 // All writes to the entire file system must be now blocked, so we have 74 // All writes to the entire file system must be now blocked, so we have
75 // to be able to safely reset the local changes and sync statuses for it. 75 // to be able to safely reset the local changes and sync statuses for it.
76 // TODO(kinuko): This should be probably automatically handled in 76 // TODO(kinuko): This should be probably automatically handled in
77 // DeleteFileSystem via QuotaUtil::DeleteOriginDataOnFileThread. 77 // DeleteFileSystem via QuotaUtil::DeleteOriginDataOnFileThread.
78 file_system_context_->default_file_task_runner()->PostTaskAndReply( 78 file_system_context_->default_file_task_runner()->PostTaskAndReply(
79 FROM_HERE, 79 FROM_HERE, base::Bind(&ResetFileChangeTracker,
80 base::Bind(&ResetFileChangeTracker, file_system_context_, url_), 80 base::RetainedRef(file_system_context_), url_),
81 base::Bind(&RootDeleteHelper::DidResetFileChangeTracker, 81 base::Bind(&RootDeleteHelper::DidResetFileChangeTracker,
82 weak_factory_.GetWeakPtr())); 82 weak_factory_.GetWeakPtr()));
83 } 83 }
84 84
85 void RootDeleteHelper::DidResetFileChangeTracker() { 85 void RootDeleteHelper::DidResetFileChangeTracker() {
86 DCHECK(!sync_status_->IsWritable(url_)); 86 DCHECK(!sync_status_->IsWritable(url_));
87 DCHECK(!sync_status_->IsWriting(url_)); 87 DCHECK(!sync_status_->IsWriting(url_));
88 88
89 // Reopening the filesystem. 89 // Reopening the filesystem.
90 file_system_context_->sandbox_delegate()->OpenFileSystem( 90 file_system_context_->sandbox_delegate()->OpenFileSystem(
91 url_.origin(), 91 url_.origin(),
92 url_.type(), 92 url_.type(),
93 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, 93 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
94 base::Bind(&RootDeleteHelper::DidOpenFileSystem, 94 base::Bind(&RootDeleteHelper::DidOpenFileSystem,
95 weak_factory_.GetWeakPtr()), 95 weak_factory_.GetWeakPtr()),
96 GURL()); 96 GURL());
97 } 97 }
98 98
99 void RootDeleteHelper::DidOpenFileSystem(const GURL& /* root */, 99 void RootDeleteHelper::DidOpenFileSystem(const GURL& /* root */,
100 const std::string& /* name */, 100 const std::string& /* name */,
101 base::File::Error error) { 101 base::File::Error error) {
102 FileStatusCallback callback = callback_; 102 FileStatusCallback callback = callback_;
103 callback.Run(error); 103 callback.Run(error);
104 } 104 }
105 105
106 } // namespace sync_file_system 106 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698