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

Unified Diff: remoting/base/multiple_array_input_stream.h

Issue 2690003: Copy the (early prototype of) remoting in Chrome into the public tree.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « remoting/base/mock_objects.h ('k') | remoting/base/multiple_array_input_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/multiple_array_input_stream.h
===================================================================
--- remoting/base/multiple_array_input_stream.h (revision 0)
+++ remoting/base/multiple_array_input_stream.h (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (c) 2010 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 REMOTING_BASE_MULTIPLE_ARRAY_INPUT_STREAM_H_
+#define REMOTING_BASE_MULTIPLE_ARRAY_INPUT_STREAM_H_
+
+#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
+#include "google/protobuf/io/zero_copy_stream.h"
+
+namespace remoting {
+
+// A MultipleArrayInputStream provides a ZeroCopyInputStream with multiple
+// backing arrays.
+class MultipleArrayInputStream :
+ public google::protobuf::io::ZeroCopyInputStream {
+ public:
+ // Construct a MultipleArrayInputStream with |count| backing arrays.
+ // TODO(hclam): Consider adding block size to see if it has a performance
+ // gain.
+ explicit MultipleArrayInputStream(int count);
+ virtual ~MultipleArrayInputStream();
+
+ virtual bool Next(const void** data, int* size);
+ virtual void BackUp(int count);
+ virtual bool Skip(int count);
+ virtual int64 ByteCount() const;
+
+ // Set the n-th buffer to be |buffer|.
+ void SetBuffer(int n, const uint8* buffer, int size);
+
+ private:
+ scoped_array<const uint8*> buffers_;
+ scoped_array<int> buffer_sizes_;
+
+ const int buffer_count_;
+
+ int current_buffer_;
+ int current_buffer_offset_;
+ int position_;
+ int last_returned_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(MultipleArrayInputStream);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_BASE_MULTIPLE_ARRAY_INPUT_STREAM_H_
Property changes on: remoting/base/multiple_array_input_stream.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « remoting/base/mock_objects.h ('k') | remoting/base/multiple_array_input_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698