| 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__
|
|
|