blob: 9f7a616fd4645e3cea4b67fa991d752a3b69dce1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright 2017 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_SERVICES_HEAP_PROFILING_RECEIVER_PIPE_POSIX_H_
#define COMPONENTS_SERVICES_HEAP_PROFILING_RECEIVER_PIPE_POSIX_H_
#include <string>
#include "base/files/platform_file.h"
#include "base/macros.h"
#include "base/message_loop/message_pump_for_io.h"
#include "build/build_config.h"
#include "components/services/heap_profiling/receiver_pipe.h"
namespace heap_profiling {
class ReceiverPipe : public ReceiverPipeBase,
public base::MessagePumpForIO::FdWatcher {
public:
explicit ReceiverPipe(mojo::edk::ScopedPlatformHandle handle);
// Must be called on the IO thread.
void StartReadingOnIOThread();
private:
~ReceiverPipe() override;
// MessagePumpForIO::FdWatcher implementation.
void OnFileCanReadWithoutBlocking(int fd) override;
void OnFileCanWriteWithoutBlocking(int fd) override;
base::MessagePumpForIO::FdWatchController controller_;
std::unique_ptr<char[]> read_buffer_;
DISALLOW_COPY_AND_ASSIGN(ReceiverPipe);
};
} // namespace heap_profiling
#endif // COMPONENTS_SERVICES_HEAP_PROFILING_RECEIVER_PIPE_POSIX_H_
|