summaryrefslogtreecommitdiff
path: root/compiler/buffered_output_stream.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2015-11-25 14:33:36 +0000
committer Vladimir Marko <vmarko@google.com> 2015-11-30 18:19:44 +0000
commit10c13565474de2786aad7c2e79757ea250747a15 (patch)
tree759bdf7aab97ab45e1a3e09f5d627e568f6e7084 /compiler/buffered_output_stream.h
parente928dc587718d00d234768f76d1efb2ffe74e885 (diff)
Refactor oat file writing to give Dex2Oat more control.
This is the first step towards writing dex files to oat file and mapping them from there for the actual AOT compilation. Change-Id: Icb0d27487eaf6ba3a66c157e695f9bdc5bb9cf9a
Diffstat (limited to 'compiler/buffered_output_stream.h')
-rw-r--r--compiler/buffered_output_stream.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/compiler/buffered_output_stream.h b/compiler/buffered_output_stream.h
index b447f41e21..1da3a6932f 100644
--- a/compiler/buffered_output_stream.h
+++ b/compiler/buffered_output_stream.h
@@ -17,6 +17,8 @@
#ifndef ART_COMPILER_BUFFERED_OUTPUT_STREAM_H_
#define ART_COMPILER_BUFFERED_OUTPUT_STREAM_H_
+#include <memory>
+
#include "output_stream.h"
#include "globals.h"
@@ -25,26 +27,23 @@ namespace art {
class BufferedOutputStream FINAL : public OutputStream {
public:
- explicit BufferedOutputStream(OutputStream* out);
+ explicit BufferedOutputStream(std::unique_ptr<OutputStream> out);
- virtual ~BufferedOutputStream() {
- Flush();
- delete out_;
- }
+ ~BufferedOutputStream() OVERRIDE;
- virtual bool WriteFully(const void* buffer, size_t byte_count);
+ bool WriteFully(const void* buffer, size_t byte_count) OVERRIDE;
- virtual off_t Seek(off_t offset, Whence whence);
+ off_t Seek(off_t offset, Whence whence) OVERRIDE;
- bool Flush();
+ bool Flush() OVERRIDE;
private:
static const size_t kBufferSize = 8 * KB;
- OutputStream* const out_;
+ bool FlushBuffer();
+ std::unique_ptr<OutputStream> const out_;
uint8_t buffer_[kBufferSize];
-
size_t used_;
DISALLOW_COPY_AND_ASSIGN(BufferedOutputStream);