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

Unified Diff: components/sync/api/data_type_error_handler_impl.h

Issue 2289143003: [Sync] Convert DTCs to be not RefCounted and NonThreadSafe. (Closed)
Patch Set: Rebase. Created 4 years, 3 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
« no previous file with comments | « components/sync/api/data_type_error_handler.h ('k') | components/sync/api/data_type_error_handler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/api/data_type_error_handler_impl.h
diff --git a/components/sync/api/data_type_error_handler_impl.h b/components/sync/api/data_type_error_handler_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..678888d79acca2e7a14a4482db5fd35ea7bd9fef
--- /dev/null
+++ b/components/sync/api/data_type_error_handler_impl.h
@@ -0,0 +1,53 @@
+// Copyright 2014 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.
+
+#ifndef COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_IMPL_H__
+#define COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_IMPL_H__
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/ptr_util.h"
+#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
+#include "components/sync/api/data_type_error_handler.h"
+
+namespace syncer {
+
+// The standard implementation of DataTypeErrorHandler.
+class DataTypeErrorHandlerImpl : public DataTypeErrorHandler {
+ public:
+ typedef base::Callback<void(const syncer::SyncError&)> ErrorCallback;
+
+ DataTypeErrorHandlerImpl(
+ const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
+ const base::Closure& dump_stack,
+ const ErrorCallback& sync_callback);
+ ~DataTypeErrorHandlerImpl() override;
+
+ void OnUnrecoverableError(const SyncError& error) override;
+ SyncError CreateAndUploadError(const tracked_objects::Location& location,
+ const std::string& message,
+ ModelType type) override;
+ std::unique_ptr<DataTypeErrorHandler> Copy() const override;
+
+ private:
+ // The thread task runner that |sync_callback_| runs on. This is passed in
+ // separately instead of bound inside the callback because we want to be able
+ // to perform the PostTask using the error location.
+ scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
+
+ // The callback to dump and upload the stack from the current thread.
+ base::Closure dump_stack_;
+
+ // The callback used to inform sync of the error on the |ui_thread_|.
+ ErrorCallback sync_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(DataTypeErrorHandlerImpl);
+};
+
+} // namespace syncer
+
+#endif // COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_IMPL_H__
« no previous file with comments | « components/sync/api/data_type_error_handler.h ('k') | components/sync/api/data_type_error_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698