Upload upstream chromium 76.0.3809.146
[platform/framework/web/chromium-efl.git] / pdf / chunk_stream.h
index 7eb75cf..2741df7 100644 (file)
@@ -81,6 +81,10 @@ class ChunkStream {
     return filled_chunks_.Contains(chunks_range);
   }
 
+  bool IsChunkAvailable(uint32_t chunk_index) const {
+    return filled_chunks_.Contains(chunk_index);
+  }
+
   void set_eof_pos(uint32_t eof_pos) { eof_pos_ = eof_pos; }
   uint32_t eof_pos() const { return eof_pos_; }
 
@@ -90,6 +94,10 @@ class ChunkStream {
     return eof_pos_ > 0 && IsRangeAvailable(gfx::Range(0, eof_pos_));
   }
 
+  bool IsValidChunkIndex(uint32_t chunk_index) const {
+    return !eof_pos_ || (chunk_index <= GetChunkIndex(eof_pos_ - 1));
+  }
+
   void Clear() {
     data_.clear();
     eof_pos_ = 0;
@@ -111,6 +119,6 @@ class ChunkStream {
   uint32_t filled_chunks_count_ = 0;
 };
 
-};  // namespace chrome_pdf
+}  // namespace chrome_pdf
 
 #endif  // PDF_CHUNK_STREAM_H_