summaryrefslogtreecommitdiff
path: root/chromium/components/feed/core/feed_content_mutation.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/feed/core/feed_content_mutation.cc')
-rw-r--r--chromium/components/feed/core/feed_content_mutation.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/chromium/components/feed/core/feed_content_mutation.cc b/chromium/components/feed/core/feed_content_mutation.cc
new file mode 100644
index 00000000000..06b1f7080e9
--- /dev/null
+++ b/chromium/components/feed/core/feed_content_mutation.cc
@@ -0,0 +1,48 @@
+// Copyright 2018 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/feed/core/feed_content_mutation.h"
+
+#include <utility>
+
+#include "base/logging.h"
+#include "components/feed/core/feed_content_operation.h"
+
+namespace feed {
+
+ContentMutation::ContentMutation() = default;
+
+ContentMutation::~ContentMutation() = default;
+
+void ContentMutation::AppendDeleteOperation(std::string key) {
+ operations_list_.emplace_back(
+ ContentOperation::CreateDeleteOperation(std::move(key)));
+}
+
+void ContentMutation::AppendDeleteAllOperation() {
+ operations_list_.emplace_back(ContentOperation::CreateDeleteAllOperation());
+}
+
+void ContentMutation::AppendDeleteByPrefixOperation(std::string prefix) {
+ operations_list_.emplace_back(
+ ContentOperation::CreateDeleteByPrefixOperation(std::move(prefix)));
+}
+
+void ContentMutation::AppendUpsertOperation(std::string key,
+ std::string value) {
+ operations_list_.emplace_back(ContentOperation::CreateUpsertOperation(
+ std::move(key), std::move(value)));
+}
+
+bool ContentMutation::Empty() {
+ return operations_list_.empty();
+}
+
+ContentOperation ContentMutation::TakeFristOperation() {
+ ContentOperation operation = std::move(operations_list_.front());
+ operations_list_.pop_front();
+ return operation;
+}
+
+} // namespace feed