]> git.sesse.net Git - casparcg/blobdiff - dependencies64/cef/linux/include/wrapper/cef_zip_archive.h
Upgrade CEF to 3.3029.1611.g44e39a8 / Chromium 58.0.3029.81.
[casparcg] / dependencies64 / cef / linux / include / wrapper / cef_zip_archive.h
similarity index 81%
rename from dependencies64/cef/include/wrapper/cef_zip_archive.h
rename to dependencies64/cef/linux/include/wrapper/cef_zip_archive.h
index 4e37d69a06d28938b64a786f7c798fc0789024d0..5de0960fcee1b4e02920e0e793da3146e88a949e 100644 (file)
 #define CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_
 #pragma once
 
-#include "include/cef_base.h"
 #include <map>
 
+#include "include/base/cef_lock.h"
+#include "include/base/cef_macros.h"
+#include "include/base/cef_ref_counted.h"
+#include "include/cef_base.h"
+
 class CefStreamReader;
 
 ///
@@ -47,42 +51,41 @@ class CefStreamReader;
 // not be used with large archive files because all data will be resident in
 // memory at the same time. This implementation supports a restricted set of zip
 // archive features:
-// (1) Password-protected files are not supported.
-// (2) All file names are stored and compared in lower case.
-// (3) File ordering from the original zip archive is not maintained. This
+// (1) All file names are stored and compared in lower case.
+// (2) File ordering from the original zip archive is not maintained. This
 //     means that files from the same folder may not be located together in the
 //     file content map.
 ///
-class CefZipArchive : public CefBase {
+class CefZipArchive : public base::RefCountedThreadSafe<CefZipArchive> {
  public:
   ///
   // Class representing a file in the archive. Accessing the file data from
   // multiple threads is safe provided a reference to the File object is kept.
   ///
-  class File : public CefBase {
+  class File : public CefBaseRefCounted {
    public:
     ///
     // Returns the read-only data contained in the file.
     ///
-    virtual const unsigned char* GetData() =0;
+    virtual const unsigned char* GetData() const =0;
 
     ///
     // Returns the size of the data in the file.
     ///
-    virtual size_t GetDataSize() =0;
+    virtual size_t GetDataSize() const =0;
 
     ///
     // Returns a CefStreamReader object for streaming the contents of the file.
     ///
-    virtual CefRefPtr<CefStreamReader> GetStreamReader() =0;
+    virtual CefRefPtr<CefStreamReader> GetStreamReader() const =0;
   };
+
   typedef std::map<CefString, CefRefPtr<File> > FileMap;
 
   ///
   // Create a new object.
   ///
   CefZipArchive();
-  virtual ~CefZipArchive();
 
   ///
   // Load the contents of the specified zip archive stream into this object.
@@ -103,17 +106,17 @@ class CefZipArchive : public CefBase {
   ///
   // Returns the number of files in the archive.
   ///
-  size_t GetFileCount();
+  size_t GetFileCount() const;
 
   ///
   // Returns true if the specified file exists and has contents.
   ///
-  bool HasFile(const CefString& fileName);
+  bool HasFile(const CefString& fileName) const;
 
   ///
   // Returns the specified file.
   ///
-  CefRefPtr<File> GetFile(const CefString& fileName);
+  CefRefPtr<File> GetFile(const CefString& fileName) const;
 
   ///
   // Removes the specified file.
@@ -123,13 +126,18 @@ class CefZipArchive : public CefBase {
   ///
   // Returns the map of all files.
   ///
-  size_t GetFiles(FileMap& map);
+  size_t GetFiles(FileMap& map) const;
 
  private:
+  // Protect against accidental deletion of this object.
+  friend class base::RefCountedThreadSafe<CefZipArchive>;
+  ~CefZipArchive();
+
   FileMap contents_;
 
-  IMPLEMENT_REFCOUNTING(CefZipArchive);
-  IMPLEMENT_LOCKING(CefZipArchive);
+  mutable base::Lock lock_;
+
+  DISALLOW_COPY_AND_ASSIGN(CefZipArchive);
 };
 
 #endif  // CEF_INCLUDE_WRAPPER_CEF_ZIP_ARCHIVE_H_