Skip to content

Commit

Permalink
Move DirectoryReader::ReadEntries to FileRef::ReadDirectoryEntries
Browse files Browse the repository at this point in the history
This also means this API becomes a stable API.

While DirectoryReader was using the new pepper proxy API, FileRef is
using the old one. As updating FileRef would take some time, the
implementation of ReadEntries is converted from the new design to the
old one for now.

BUG=234513
TEST=browser_tests
R=avi@chromium.org, binji@chromium.org, dmichael@chromium.org, palmer@chromium.org, raymes@chromium.org, teravest@chromium.org

Review URL: https://codereview.chromium.org/14784002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198204 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
hamaji@chromium.org committed May 3, 2013
1 parent 222c700 commit 2dea98e
Show file tree
Hide file tree
Showing 61 changed files with 830 additions and 1,239 deletions.
3 changes: 0 additions & 3 deletions chrome/test/ppapi/ppapi_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,6 @@ TEST_PPAPI_NACL(MAYBE_Fullscreen)
TEST_PPAPI_IN_PROCESS(X509CertificatePrivate)
TEST_PPAPI_OUT_OF_PROCESS(X509CertificatePrivate)

TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(DirectoryReader)
TEST_PPAPI_NACL(DirectoryReader);

// There is no proxy. This is used for PDF metrics reporting, and PDF only
// runs in process, so there's currently no need for a proxy.
TEST_PPAPI_IN_PROCESS(UMA)
Expand Down
2 changes: 0 additions & 2 deletions content/content_renderer.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@
'renderer/pepper/pepper_device_enumeration_event_handler.h',
'renderer/pepper/pepper_device_enumeration_host_helper.cc',
'renderer/pepper/pepper_device_enumeration_host_helper.h',
'renderer/pepper/pepper_directory_reader_host.cc',
'renderer/pepper/pepper_directory_reader_host.h',
'renderer/pepper/pepper_file_chooser_host.cc',
'renderer/pepper/pepper_file_chooser_host.h',
'renderer/pepper/pepper_file_io_host.cc',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "content/renderer/pepper/pepper_audio_input_host.h"
#include "content/renderer/pepper/pepper_directory_reader_host.h"
#include "content/renderer/pepper/pepper_file_chooser_host.h"
#include "content/renderer/pepper/pepper_file_io_host.h"
#include "content/renderer/pepper/pepper_file_system_host.h"
Expand Down Expand Up @@ -84,9 +83,6 @@ scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost(
case PpapiHostMsg_AudioInput_Create::ID:
return scoped_ptr<ResourceHost>(new PepperAudioInputHost(
host_, instance, params.pp_resource()));
case PpapiHostMsg_DirectoryReader_Create::ID:
return scoped_ptr<ResourceHost>(new PepperDirectoryReaderHost(
host_, instance, params.pp_resource()));
case PpapiHostMsg_FileChooser_Create::ID:
return scoped_ptr<ResourceHost>(new PepperFileChooserHost(
host_, instance, params.pp_resource()));
Expand Down
189 changes: 0 additions & 189 deletions content/renderer/pepper/pepper_directory_reader_host.cc

This file was deleted.

72 changes: 0 additions & 72 deletions content/renderer/pepper/pepper_directory_reader_host.h

This file was deleted.

8 changes: 8 additions & 0 deletions content/renderer/pepper/pepper_plugin_delegate_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,14 @@ bool PepperPluginDelegateImpl::Query(
return file_system_dispatcher->ReadMetadata(path, dispatcher);
}

bool PepperPluginDelegateImpl::ReadDirectoryEntries(
const GURL& path,
fileapi::FileSystemCallbackDispatcher* dispatcher) {
FileSystemDispatcher* file_system_dispatcher =
ChildThread::current()->file_system_dispatcher();
return file_system_dispatcher->ReadDirectory(path, dispatcher);
}

bool PepperPluginDelegateImpl::Touch(
const GURL& path,
const base::Time& last_access_time,
Expand Down
3 changes: 3 additions & 0 deletions content/renderer/pepper/pepper_plugin_delegate_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ class PepperPluginDelegateImpl
virtual bool Query(
const GURL& path,
fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
virtual bool ReadDirectoryEntries(
const GURL& path,
fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE;
virtual bool Touch(
const GURL& path,
const base::Time& last_access_time,
Expand Down
27 changes: 6 additions & 21 deletions native_client_sdk/src/libraries/nacl_io/mount_node_html5fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <errno.h>
#include <fcntl.h>
#include <ppapi/c/pp_completion_callback.h>
#include <ppapi/c/pp_directory_entry.h>
#include <ppapi/c/pp_errors.h>
#include <ppapi/c/pp_file_info.h>
#include <ppapi/c/ppb_file_io.h>
Expand Down Expand Up @@ -75,13 +76,6 @@ int MountNodeHtml5Fs::FSync() {
}

int MountNodeHtml5Fs::GetDents(size_t offs, struct dirent* pdir, size_t size) {
// The directory reader interface is a dev interface, if it doesn't exist,
// just fail.
if (!mount_->ppapi()->GetDirectoryReaderInterface()) {
errno = ENOSYS;
return -1;
}

// If the buffer pointer is invalid, fail
if (NULL == pdir) {
errno = EINVAL;
Expand All @@ -94,28 +88,19 @@ int MountNodeHtml5Fs::GetDents(size_t offs, struct dirent* pdir, size_t size) {
return -1;
}

ScopedResource directory_reader(
mount_->ppapi(),
mount_->ppapi()->GetDirectoryReaderInterface()->Create(
fileref_resource_));
if (!directory_reader.pp_resource()) {
errno = ENOSYS;
return -1;
}

OutputBuffer output_buf = { NULL, 0 };
PP_ArrayOutput output = { &GetOutputBuffer, &output_buf };
int32_t result = mount_->ppapi()->GetDirectoryReaderInterface()->ReadEntries(
directory_reader.pp_resource(), output,
PP_BlockUntilComplete());
int32_t result =
mount_->ppapi()->GetFileRefInterface()->ReadDirectoryEntries(
fileref_resource_, output, PP_BlockUntilComplete());
if (result != PP_OK) {
errno = PPErrorToErrno(result);
return -1;
}

std::vector<struct dirent> dirents;
PP_DirectoryEntry_Dev* entries =
static_cast<PP_DirectoryEntry_Dev*>(output_buf.data);
PP_DirectoryEntry* entries =
static_cast<PP_DirectoryEntry*>(output_buf.data);

for (int i = 0; i < output_buf.element_count; ++i) {
PP_Var file_name_var = mount_->ppapi()->GetFileRefInterface()->GetName(
Expand Down
Loading

0 comments on commit 2dea98e

Please sign in to comment.