Commit 09dcdf81 authored by kinuko@chromium.org's avatar kinuko@chromium.org

Make WebFileSystemCallbacks not self-destruct

It's multi-sided patch, so again it has ugly ifdefs.

Corresponding blink patch:
https://codereview.chromium.org/23704004/

BUG=257349
TEST=try, both with and without Blink patch

Review URL: https://chromiumcodereview.appspot.com/23762002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221710 0039d316-1c4b-4281-b951-d872f2087c98
parent e0532fb0
This diff is collapsed.
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
#ifndef CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_ #ifndef CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_
#define CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_ #define CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_
#include <map>
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/id_map.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/threading/non_thread_safe.h" #include "base/threading/non_thread_safe.h"
#include "third_party/WebKit/public/platform/WebFileSystem.h" #include "third_party/WebKit/public/platform/WebFileSystem.h"
...@@ -23,6 +24,13 @@ class WebFileWriter; ...@@ -23,6 +24,13 @@ class WebFileWriter;
class WebFileWriterClient; class WebFileWriterClient;
} }
// TODO(kinuko): Remove this hack after the two-sided patch lands.
#ifdef NON_SELFDESTRUCT_WEBFILESYSTEMCALLBACKS
typedef WebKit::WebFileSystemCallbacks WebFileSystemCallbacksType;
#else
typedef WebKit::WebFileSystemCallbacks* WebFileSystemCallbacksType;
#endif
namespace content { namespace content {
class WebFileSystemImpl class WebFileSystemImpl
...@@ -52,62 +60,67 @@ class WebFileSystemImpl ...@@ -52,62 +60,67 @@ class WebFileSystemImpl
const WebKit::WebURL& storage_partition, const WebKit::WebURL& storage_partition,
const WebKit::WebFileSystemType type, const WebKit::WebFileSystemType type,
bool create, bool create,
WebKit::WebFileSystemCallbacks*); WebFileSystemCallbacksType);
virtual void deleteFileSystem( virtual void deleteFileSystem(
const WebKit::WebURL& storage_partition, const WebKit::WebURL& storage_partition,
const WebKit::WebFileSystemType type, const WebKit::WebFileSystemType type,
WebKit::WebFileSystemCallbacks*); WebFileSystemCallbacksType);
virtual void move( virtual void move(
const WebKit::WebURL& src_path, const WebKit::WebURL& src_path,
const WebKit::WebURL& dest_path, const WebKit::WebURL& dest_path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void copy( virtual void copy(
const WebKit::WebURL& src_path, const WebKit::WebURL& src_path,
const WebKit::WebURL& dest_path, const WebKit::WebURL& dest_path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void remove( virtual void remove(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void removeRecursively( virtual void removeRecursively(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void readMetadata( virtual void readMetadata(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void createFile( virtual void createFile(
const WebKit::WebURL& path, const WebKit::WebURL& path,
bool exclusive, bool exclusive,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void createDirectory( virtual void createDirectory(
const WebKit::WebURL& path, const WebKit::WebURL& path,
bool exclusive, bool exclusive,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void fileExists( virtual void fileExists(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void directoryExists( virtual void directoryExists(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void readDirectory( virtual void readDirectory(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual WebKit::WebFileWriter* createFileWriter( virtual WebKit::WebFileWriter* createFileWriter(
const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; const WebKit::WebURL& path,
WebKit::WebFileWriterClient*);
virtual void createFileWriter( virtual void createFileWriter(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileWriterClient*, WebKit::WebFileWriterClient*,
WebKit::WebFileSystemCallbacks*) OVERRIDE; WebFileSystemCallbacksType) OVERRIDE;
virtual void createSnapshotFileAndReadMetadata( virtual void createSnapshotFileAndReadMetadata(
const WebKit::WebURL& path, const WebKit::WebURL& path,
WebKit::WebFileSystemCallbacks*); WebFileSystemCallbacksType);
int RegisterCallbacks(WebKit::WebFileSystemCallbacks* callbacks); int RegisterCallbacks(WebFileSystemCallbacksType callbacks);
WebKit::WebFileSystemCallbacks* GetAndUnregisterCallbacks( WebFileSystemCallbacksType GetAndUnregisterCallbacks(
int callbacks_id); int callbacks_id);
private: private:
typedef std::map<int, WebFileSystemCallbacksType> CallbacksMap;
scoped_refptr<base::MessageLoopProxy> main_thread_loop_; scoped_refptr<base::MessageLoopProxy> main_thread_loop_;
IDMap<WebKit::WebFileSystemCallbacks> callbacks_;
CallbacksMap callbacks_;
int next_callbacks_id_;
DISALLOW_COPY_AND_ASSIGN(WebFileSystemImpl); DISALLOW_COPY_AND_ASSIGN(WebFileSystemImpl);
}; };
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include "content/child/fileapi/webfilewriter_base.h" #include "content/child/fileapi/webfilewriter_base.h"
#include "base/logging.h" #include "base/logging.h"
#include "third_party/WebKit/public/platform/WebFileError.h"
#include "third_party/WebKit/public/platform/WebFileWriterClient.h"
#include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebFileError.h"
#include "third_party/WebKit/public/web/WebFileWriterClient.h"
#include "webkit/common/fileapi/file_system_util.h" #include "webkit/common/fileapi/file_system_util.h"
using fileapi::PlatformFileErrorToWebFileError; using fileapi::PlatformFileErrorToWebFileError;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/platform_file.h" #include "base/platform_file.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "third_party/WebKit/public/web/WebFileWriter.h" #include "third_party/WebKit/public/platform/WebFileWriter.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace WebKit { namespace WebKit {
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebFileError.h"
#include "third_party/WebKit/public/platform/WebFileWriterClient.h"
#include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebFileError.h"
#include "third_party/WebKit/public/web/WebFileWriterClient.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace content { namespace content {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/platform_file.h" #include "base/platform_file.h"
#include "third_party/WebKit/public/web/WebFileError.h" #include "third_party/WebKit/public/platform/WebFileError.h"
#include "third_party/WebKit/public/platform/WebFileSystemType.h" #include "third_party/WebKit/public/platform/WebFileSystemType.h"
#include "webkit/common/fileapi/file_system_types.h" #include "webkit/common/fileapi/file_system_types.h"
#include "webkit/common/quota/quota_types.h" #include "webkit/common/quota/quota_types.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment