mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This updates to mojo commit d259eb58aa59 and limits the roll script to only pull in the parts of //mojo that are currently being used. More stuff will be dropped in the future.
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
// 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 MOJO_DATA_PIPE_UTILS_DATA_PIPE_UTILS_H_
|
|
#define MOJO_DATA_PIPE_UTILS_DATA_PIPE_UTILS_H_
|
|
|
|
#include <string>
|
|
|
|
#include "base/callback_forward.h"
|
|
#include "base/threading/platform_thread.h"
|
|
#include "mojo/public/cpp/system/core.h"
|
|
|
|
namespace base {
|
|
class FilePath;
|
|
class TaskRunner;
|
|
}
|
|
|
|
namespace mojo {
|
|
namespace common {
|
|
|
|
// Asynchronously copies data from source to the destination file. The given
|
|
// |callback| is run upon completion. File writes will be scheduled to the
|
|
// given |task_runner|.
|
|
void CopyToFile(ScopedDataPipeConsumerHandle source,
|
|
const base::FilePath& destination,
|
|
base::TaskRunner* task_runner,
|
|
const base::Callback<void(bool /*success*/)>& callback);
|
|
|
|
void CopyFromFile(const base::FilePath& source,
|
|
ScopedDataPipeProducerHandle destination,
|
|
uint32_t skip,
|
|
base::TaskRunner* task_runner,
|
|
const base::Callback<void(bool /*success*/)>& callback);
|
|
|
|
// Copies the data from |source| into |contents| and returns true on success and
|
|
// false on error. In case of I/O error, |contents| holds the data that could
|
|
// be read from source before the error occurred.
|
|
bool BlockingCopyToString(ScopedDataPipeConsumerHandle source,
|
|
std::string* contents);
|
|
|
|
bool BlockingCopyFromString(const std::string& source,
|
|
const ScopedDataPipeProducerHandle& destination);
|
|
|
|
// Synchronously copies data from source to the destination file returning true
|
|
// on success and false on error. In case of an error, |destination| holds the
|
|
// data that could be read from the source before the error occured.
|
|
bool BlockingCopyToFile(ScopedDataPipeConsumerHandle source,
|
|
const base::FilePath& destination);
|
|
|
|
} // namespace common
|
|
} // namespace mojo
|
|
|
|
#endif // MOJO_DATA_PIPE_UTILS_DATA_PIPE_UTILS_H_
|