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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc

Issue 2048993002: Add an API to get total size of Drive cache including non-evictable ones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an unnecessary parameter. Created 4 years, 6 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 | « no previous file | components/drive/chromeos/dummy_file_system.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromeos/extensions/file_manager/private_api_file_syste m.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste m.h"
6 6
7 #include <sys/statvfs.h> 7 #include <sys/statvfs.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Used for OnCalculateEvictableCacheSize. 83 // Used for OnCalculateEvictableCacheSize.
84 typedef base::Callback<void(const uint64_t* total_size, 84 typedef base::Callback<void(const uint64_t* total_size,
85 const uint64_t* remaining_space)> 85 const uint64_t* remaining_space)>
86 GetSizeStatsCallback; 86 GetSizeStatsCallback;
87 87
88 // Calculates the real remaining size of Download volume and pass it to 88 // Calculates the real remaining size of Download volume and pass it to
89 // GetSizeStatsCallback. 89 // GetSizeStatsCallback.
90 void OnCalculateEvictableCacheSize(const GetSizeStatsCallback& callback, 90 void OnCalculateEvictableCacheSize(const GetSizeStatsCallback& callback,
91 uint64_t total_size, 91 uint64_t total_size,
92 uint64_t remaining_size, 92 uint64_t remaining_size,
93 uint64_t evictable_cache_size) { 93 int64_t evictable_cache_size) {
94 // For calculating real remaining size of Download volume 94 // For calculating real remaining size of Download volume
95 // - Adds evictable cache size since the space is available if they are 95 // - Adds evictable cache size since the space is available if they are
96 // evicted. 96 // evicted.
97 // - Subtracts minimum free space of cryptohome since the space is not 97 // - Subtracts minimum free space of cryptohome since the space is not
98 // available for file manager. 98 // available for file manager.
99 const uint64_t real_remaining_size = 99 const uint64_t real_remaining_size =
100 std::max(static_cast<int64_t>(remaining_size + evictable_cache_size) - 100 std::max(static_cast<int64_t>(remaining_size + evictable_cache_size) -
101 cryptohome::kMinFreeSpaceInBytes, 101 cryptohome::kMinFreeSpaceInBytes,
102 int64_t(0)); 102 int64_t(0));
103 callback.Run(&total_size, &real_remaining_size); 103 callback.Run(&total_size, &real_remaining_size);
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 return RespondLater(); 993 return RespondLater();
994 } 994 }
995 995
996 void FileManagerPrivateInternalSetEntryTagFunction::OnSetEntryPropertyCompleted( 996 void FileManagerPrivateInternalSetEntryTagFunction::OnSetEntryPropertyCompleted(
997 drive::FileError result) { 997 drive::FileError result) {
998 Respond(result == drive::FILE_ERROR_OK ? NoArguments() 998 Respond(result == drive::FILE_ERROR_OK ? NoArguments()
999 : Error("Failed to set a tag.")); 999 : Error("Failed to set a tag."));
1000 } 1000 }
1001 1001
1002 } // namespace extensions 1002 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | components/drive/chromeos/dummy_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698