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

Unified Diff: chrome/browser/extensions/api/bookmarks/bookmarks_api.cc

Issue 411053002: Remove bookmarks API client-side write operations limits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
index b4022e607ddcae228829a718529a9fae8b003084..344bf101ab4ba23150ca73711669d31ec34dab84 100644
--- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
+++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc
@@ -921,81 +921,6 @@ class BookmarkIdMapper : public BookmarkBucketMapper<int64> {
}
};
-// Builds heuristics for all BookmarkFunctions using specialized BucketMappers.
-class BookmarksQuotaLimitFactory {
- public:
- // For id-based bookmark functions.
- template <class FunctionType>
- static void Build(QuotaLimitHeuristics* heuristics) {
- BuildWithMappers(heuristics, new BookmarkIdMapper<FunctionType>(),
- new BookmarkIdMapper<FunctionType>());
- }
-
- // For bookmarks.create.
- static void BuildForCreate(QuotaLimitHeuristics* heuristics,
- BrowserContext* context) {
- BuildWithMappers(heuristics,
- new CreateBookmarkBucketMapper(context),
- new CreateBookmarkBucketMapper(context));
- }
-
- // For bookmarks.remove.
- static void BuildForRemove(QuotaLimitHeuristics* heuristics,
- BrowserContext* context) {
- BuildWithMappers(heuristics,
- new RemoveBookmarksBucketMapper(context),
- new RemoveBookmarksBucketMapper(context));
- }
-
- private:
- static void BuildWithMappers(QuotaLimitHeuristics* heuristics,
- BucketMapper* short_mapper, BucketMapper* long_mapper) {
- const Config kSustainedLimitConfig = {
- // See bookmarks.json for current value.
- bookmarks::MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE,
- TimeDelta::FromMinutes(1)
- };
- heuristics->push_back(new SustainedLimit(
- TimeDelta::FromMinutes(10),
- kSustainedLimitConfig,
- short_mapper,
- "MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE"));
-
- const Config kTimedLimitConfig = {
- // See bookmarks.json for current value.
- bookmarks::MAX_WRITE_OPERATIONS_PER_HOUR,
- TimeDelta::FromHours(1)
- };
- heuristics->push_back(new TimedLimit(
- kTimedLimitConfig,
- long_mapper,
- "MAX_WRITE_OPERATIONS_PER_HOUR"));
- }
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(BookmarksQuotaLimitFactory);
-};
-
-// And finally, building the individual heuristics for each function.
-void BookmarksRemoveFunction::GetQuotaLimitHeuristics(
- QuotaLimitHeuristics* heuristics) const {
- BookmarksQuotaLimitFactory::BuildForRemove(heuristics, GetProfile());
-}
-
-void BookmarksMoveFunction::GetQuotaLimitHeuristics(
- QuotaLimitHeuristics* heuristics) const {
- BookmarksQuotaLimitFactory::Build<BookmarksMoveFunction>(heuristics);
-}
-
-void BookmarksUpdateFunction::GetQuotaLimitHeuristics(
- QuotaLimitHeuristics* heuristics) const {
- BookmarksQuotaLimitFactory::Build<BookmarksUpdateFunction>(heuristics);
-}
-
-void BookmarksCreateFunction::GetQuotaLimitHeuristics(
- QuotaLimitHeuristics* heuristics) const {
- BookmarksQuotaLimitFactory::BuildForCreate(heuristics, GetProfile());
-}
-
BookmarksIOFunction::BookmarksIOFunction() {}
BookmarksIOFunction::~BookmarksIOFunction() {

Powered by Google App Engine
This is Rietveld 408576698