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

Unified Diff: webkit/plugins/ppapi/ppb_file_io_impl.cc

Issue 7669055: Remove webkit::ppapi::Resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix self-assignment Created 9 years, 4 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
Index: webkit/plugins/ppapi/ppb_file_io_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_file_io_impl.cc b/webkit/plugins/ppapi/ppb_file_io_impl.cc
index 63021fa95ca1743c04a185a39996f490642f7e40..550acbd70e44e84ab9974d3581cf25e87ec02d26 100644
--- a/webkit/plugins/ppapi/ppb_file_io_impl.cc
+++ b/webkit/plugins/ppapi/ppb_file_io_impl.cc
@@ -24,6 +24,7 @@
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
#include "webkit/plugins/ppapi/quota_file_io.h"
+#include "webkit/plugins/ppapi/resource_helper.h"
#include "webkit/plugins/ppapi/resource_tracker.h"
using ppapi::PPTimeToTime;
@@ -47,7 +48,7 @@ PPB_FileIO_Impl::CallbackEntry::CallbackEntry(const CallbackEntry& entry)
PPB_FileIO_Impl::CallbackEntry::~CallbackEntry() {
}
-PPB_FileIO_Impl::PPB_FileIO_Impl(PluginInstance* instance)
+PPB_FileIO_Impl::PPB_FileIO_Impl(PP_Instance instance)
: Resource(instance),
ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
file_(base::kInvalidPlatformFileValue),
@@ -83,7 +84,7 @@ int32_t PPB_FileIO_Impl::Open(PP_Resource pp_file_ref,
file_system_type_ = file_ref->GetFileSystemType();
switch (file_system_type_) {
case PP_FILESYSTEMTYPE_EXTERNAL:
- if (!instance()->delegate()->AsyncOpenFile(
+ if (!GetPluginDelegate()->AsyncOpenFile(
file_ref->GetSystemPath(), flags,
callback_factory_.NewCallback(
&PPB_FileIO_Impl::AsyncOpenFileCallback)))
@@ -92,7 +93,7 @@ int32_t PPB_FileIO_Impl::Open(PP_Resource pp_file_ref,
case PP_FILESYSTEMTYPE_LOCALPERSISTENT:
case PP_FILESYSTEMTYPE_LOCALTEMPORARY:
file_system_url_ = file_ref->GetFileSystemURL();
- if (!instance()->delegate()->AsyncOpenFileSystemURL(
+ if (!GetPluginDelegate()->AsyncOpenFileSystemURL(
file_system_url_, flags,
callback_factory_.NewCallback(
&PPB_FileIO_Impl::AsyncOpenFileCallback)))
@@ -119,7 +120,7 @@ int32_t PPB_FileIO_Impl::Query(PP_FileInfo* info,
info_ = info;
if (!base::FileUtilProxy::GetFileInfoFromPlatformFile(
- instance()->delegate()->GetFileThreadMessageLoopProxy(), file_,
+ GetPluginDelegate()->GetFileThreadMessageLoopProxy(), file_,
callback_factory_.NewCallback(&PPB_FileIO_Impl::QueryInfoCallback)))
return PP_ERROR_FAILED;
@@ -135,7 +136,7 @@ int32_t PPB_FileIO_Impl::Touch(PP_Time last_access_time,
return rv;
if (!base::FileUtilProxy::Touch(
- instance()->delegate()->GetFileThreadMessageLoopProxy(),
+ GetPluginDelegate()->GetFileThreadMessageLoopProxy(),
file_, PPTimeToTime(last_access_time),
PPTimeToTime(last_modified_time),
callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback)))
@@ -154,7 +155,7 @@ int32_t PPB_FileIO_Impl::Read(int64_t offset,
return rv;
if (!base::FileUtilProxy::Read(
- instance()->delegate()->GetFileThreadMessageLoopProxy(),
+ GetPluginDelegate()->GetFileThreadMessageLoopProxy(),
file_, offset, bytes_to_read,
callback_factory_.NewCallback(&PPB_FileIO_Impl::ReadCallback)))
return PP_ERROR_FAILED;
@@ -178,7 +179,7 @@ int32_t PPB_FileIO_Impl::Write(int64_t offset,
return PP_ERROR_FAILED;
} else {
if (!base::FileUtilProxy::Write(
- instance()->delegate()->GetFileThreadMessageLoopProxy(),
+ GetPluginDelegate()->GetFileThreadMessageLoopProxy(),
file_, offset, buffer, bytes_to_write,
callback_factory_.NewCallback(&PPB_FileIO_Impl::WriteCallback)))
return PP_ERROR_FAILED;
@@ -201,7 +202,7 @@ int32_t PPB_FileIO_Impl::SetLength(int64_t length,
return PP_ERROR_FAILED;
} else {
if (!base::FileUtilProxy::Truncate(
- instance()->delegate()->GetFileThreadMessageLoopProxy(),
+ GetPluginDelegate()->GetFileThreadMessageLoopProxy(),
file_, length,
callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback)))
return PP_ERROR_FAILED;
@@ -217,7 +218,7 @@ int32_t PPB_FileIO_Impl::Flush(PP_CompletionCallback callback) {
return rv;
if (!base::FileUtilProxy::Flush(
- instance()->delegate()->GetFileThreadMessageLoopProxy(), file_,
+ GetPluginDelegate()->GetFileThreadMessageLoopProxy(), file_,
callback_factory_.NewCallback(&PPB_FileIO_Impl::StatusCallback)))
return PP_ERROR_FAILED;
@@ -228,7 +229,7 @@ int32_t PPB_FileIO_Impl::Flush(PP_CompletionCallback callback) {
void PPB_FileIO_Impl::Close() {
if (file_ != base::kInvalidPlatformFileValue) {
base::FileUtilProxy::Close(
- instance()->delegate()->GetFileThreadMessageLoopProxy(), file_, NULL);
+ GetPluginDelegate()->GetFileThreadMessageLoopProxy(), file_, NULL);
file_ = base::kInvalidPlatformFileValue;
quota_file_io_.reset();
}
@@ -315,7 +316,8 @@ void PPB_FileIO_Impl::RegisterCallback(OperationType op,
CallbackEntry entry;
entry.callback = new TrackedCompletionCallback(
- instance()->module()->GetCallbackTracker(), pp_resource(), callback);
+ ResourceHelper::GetPluginModule(this)->GetCallbackTracker(),
+ pp_resource(), callback);
entry.read_buffer = read_buffer;
callbacks_.push(entry);
@@ -358,7 +360,7 @@ void PPB_FileIO_Impl::AsyncOpenFileCallback(
(file_system_type_ == PP_FILESYSTEMTYPE_LOCALTEMPORARY ||
file_system_type_ == PP_FILESYSTEMTYPE_LOCALPERSISTENT)) {
quota_file_io_.reset(new QuotaFileIO(
- instance(), file_, file_system_url_, file_system_type_));
+ pp_instance(), file_, file_system_url_, file_system_type_));
}
RunAndRemoveFirstPendingCallback(PlatformFileErrorToPepperError(error_code));
@@ -441,5 +443,9 @@ void PPB_FileIO_Impl::WillWriteCallback(base::PlatformFileError error_code,
}
}
+PluginDelegate* PPB_FileIO_Impl::GetPluginDelegate() const {
+ return ResourceHelper::GetPluginDelegate(this);
+}
+
} // namespace ppapi
} // namespace webkit

Powered by Google App Engine
This is Rietveld 408576698