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

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

Issue 7006022: Revert 87415 - Convert more interfaces to the new thunk system. This goes up to and including (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 | « webkit/plugins/ppapi/ppb_directory_reader_impl.h ('k') | webkit/plugins/ppapi/ppb_file_chooser_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_directory_reader_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_directory_reader_impl.cc (revision 87436)
+++ webkit/plugins/ppapi/ppb_directory_reader_impl.cc (working copy)
@@ -9,8 +9,6 @@
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/dev/ppb_directory_reader_dev.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/ppb_file_ref_api.h"
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/file_callbacks.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
@@ -20,10 +18,6 @@
#include "webkit/plugins/ppapi/ppb_file_system_impl.h"
#include "webkit/plugins/ppapi/resource_tracker.h"
-using ::ppapi::thunk::EnterResourceNoLock;
-using ::ppapi::thunk::PPB_DirectoryReader_API;
-using ::ppapi::thunk::PPB_FileRef_API;
-
namespace webkit {
namespace ppapi {
@@ -49,6 +43,38 @@
#endif
}
+PP_Resource Create(PP_Resource directory_ref_id) {
+ scoped_refptr<PPB_FileRef_Impl> directory_ref(
+ Resource::GetAs<PPB_FileRef_Impl>(directory_ref_id));
+ if (!directory_ref)
+ return 0;
+
+ PPB_DirectoryReader_Impl* reader =
+ new PPB_DirectoryReader_Impl(directory_ref);
+ return reader->GetReference();
+}
+
+PP_Bool IsDirectoryReader(PP_Resource resource) {
+ return BoolToPPBool(!!Resource::GetAs<PPB_DirectoryReader_Impl>(resource));
+}
+
+int32_t GetNextEntry(PP_Resource reader_id,
+ PP_DirectoryEntry_Dev* entry,
+ PP_CompletionCallback callback) {
+ scoped_refptr<PPB_DirectoryReader_Impl> reader(
+ Resource::GetAs<PPB_DirectoryReader_Impl>(reader_id));
+ if (!reader)
+ return PP_ERROR_BADRESOURCE;
+
+ return reader->GetNextEntry(entry, callback);
+}
+
+const PPB_DirectoryReader_Dev ppb_directoryreader = {
+ &Create,
+ &IsDirectoryReader,
+ &GetNextEntry
+};
+
} // namespace
PPB_DirectoryReader_Impl::PPB_DirectoryReader_Impl(
@@ -62,15 +88,8 @@
PPB_DirectoryReader_Impl::~PPB_DirectoryReader_Impl() {
}
-// static
-PP_Resource PPB_DirectoryReader_Impl::Create(PP_Resource directory_ref) {
- EnterResourceNoLock<PPB_FileRef_API> enter(directory_ref, true);
- if (enter.failed())
- return 0;
-
- PPB_DirectoryReader_Impl* reader = new PPB_DirectoryReader_Impl(
- static_cast<PPB_FileRef_Impl*>(enter.object()));
- return reader->GetReference();
+const PPB_DirectoryReader_Dev* PPB_DirectoryReader_Impl::GetInterface() {
+ return &ppb_directoryreader;
}
PPB_DirectoryReader_Impl*
@@ -78,10 +97,6 @@
return this;
}
-PPB_DirectoryReader_API* PPB_DirectoryReader_Impl::AsPPB_DirectoryReader_API() {
- return this;
-}
-
int32_t PPB_DirectoryReader_Impl::GetNextEntry(
PP_DirectoryEntry_Dev* entry,
PP_CompletionCallback callback) {
@@ -94,7 +109,7 @@
return PP_OK;
}
- PluginInstance* instance = directory_ref_->instance();
+ PluginInstance* instance = directory_ref_->GetFileSystem()->instance();
PP_Resource resource_id = GetReferenceNoAddRef();
DCHECK(resource_id != 0);
if (!instance->delegate()->ReadDirectory(
@@ -111,7 +126,7 @@
const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more) {
DCHECK(!entries.empty() || !has_more);
has_more_ = has_more;
- std::string dir_path = directory_ref_->virtual_path();
+ std::string dir_path = directory_ref_->GetPath();
if (dir_path[dir_path.size() - 1] != '/')
dir_path += '/';
FilePath::StringType dir_file_path = UTF8StringToFilePathString(dir_path);
@@ -135,7 +150,7 @@
if (entry_->file_ref)
ResourceTracker::Get()->UnrefResource(entry_->file_ref);
PPB_FileRef_Impl* file_ref =
- new PPB_FileRef_Impl(instance(), directory_ref_->file_system(),
+ new PPB_FileRef_Impl(instance(), directory_ref_->GetFileSystem(),
FilePathStringToUTF8String(dir_entry.name));
entry_->file_ref = file_ref->GetReference();
entry_->file_type =
« no previous file with comments | « webkit/plugins/ppapi/ppb_directory_reader_impl.h ('k') | webkit/plugins/ppapi/ppb_file_chooser_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698