summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h2
-rw-r--r--ppapi/thunk/ppb_directory_reader_api.h28
-rw-r--r--ppapi/thunk/ppb_directory_reader_thunk.cc61
-rw-r--r--ppapi/thunk/ppb_file_ref_api.h21
-rw-r--r--ppapi/thunk/ppb_file_ref_thunk.cc13
-rw-r--r--ppapi/thunk/resource_creation_api.h2
6 files changed, 33 insertions, 94 deletions
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index c8f1ae7..707e0e5 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -12,8 +12,6 @@
PROXIED_IFACE(PPB_Instance, "PPB_Console(Dev);0.1", PPB_Console_1_0)
PROXIED_IFACE(NoAPIName, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4,
PPB_CursorControl_Dev_0_4)
-PROXIED_IFACE(NoAPIName, PPB_DIRECTORYREADER_DEV_INTERFACE_0_6,
- PPB_DirectoryReader_Dev_0_6)
PROXIED_IFACE(NoAPIName, PPB_EXT_ALARMS_DEV_INTERFACE_0_1,
PPB_Ext_Alarms_Dev_0_1)
PROXIED_IFACE(NoAPIName, PPB_EXT_SOCKET_DEV_INTERFACE_0_1,
diff --git a/ppapi/thunk/ppb_directory_reader_api.h b/ppapi/thunk/ppb_directory_reader_api.h
deleted file mode 100644
index cf71ddf..0000000
--- a/ppapi/thunk/ppb_directory_reader_api.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PPAPI_THUNK_DIRECTORY_READER_API_H_
-#define PPAPI_THUNK_DIRECTORY_READER_API_H_
-
-#include "base/memory/ref_counted.h"
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
-
-namespace ppapi {
-
-class TrackedCallback;
-
-namespace thunk {
-
-class PPB_DirectoryReader_API {
- public:
- virtual ~PPB_DirectoryReader_API() {}
-
- virtual int32_t ReadEntries(const PP_ArrayOutput& output,
- scoped_refptr<TrackedCallback> callback) = 0;
-};
-
-} // namespace thunk
-} // namespace ppapi
-
-#endif // PPAPI_THUNK_DIRECTORY_READER_API_H_
diff --git a/ppapi/thunk/ppb_directory_reader_thunk.cc b/ppapi/thunk/ppb_directory_reader_thunk.cc
deleted file mode 100644
index aaee6f7..0000000
--- a/ppapi/thunk/ppb_directory_reader_thunk.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ppapi/c/dev/ppb_directory_reader_dev.h"
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/shared_impl/proxy_lock.h"
-#include "ppapi/shared_impl/tracked_callback.h"
-#include "ppapi/thunk/enter.h"
-#include "ppapi/thunk/thunk.h"
-#include "ppapi/thunk/ppb_directory_reader_api.h"
-#include "ppapi/thunk/resource_creation_api.h"
-
-namespace ppapi {
-namespace thunk {
-
-namespace {
-
-PP_Resource Create(PP_Resource directory_ref) {
- ppapi::ProxyAutoLock lock;
- Resource* object =
- PpapiGlobals::Get()->GetResourceTracker()->GetResource(directory_ref);
- if (!object)
- return 0;
- EnterResourceCreationNoLock enter(object->pp_instance());
- if (enter.failed())
- return 0;
- return enter.functions()->CreateDirectoryReader(
- object->pp_instance(), directory_ref);
-}
-
-PP_Bool IsDirectoryReader(PP_Resource resource) {
- EnterResource<PPB_DirectoryReader_API> enter(resource, false);
- return PP_FromBool(enter.succeeded());
-}
-
-int32_t ReadEntries(PP_Resource directory_reader,
- PP_ArrayOutput output,
- PP_CompletionCallback callback) {
- EnterResource<PPB_DirectoryReader_API> enter(
- directory_reader, callback, true);
- if (enter.failed())
- return enter.retval();
- return enter.SetResult(enter.object()->ReadEntries(output, enter.callback()));
-}
-
-const PPB_DirectoryReader_Dev g_ppb_directory_reader_thunk = {
- &Create,
- &IsDirectoryReader,
- &ReadEntries
-};
-
-} // namespace
-
-const PPB_DirectoryReader_Dev_0_6* GetPPB_DirectoryReader_Dev_0_6_Thunk() {
- return &g_ppb_directory_reader_thunk;
-}
-
-} // namespace thunk
-} // namespace ppapi
diff --git a/ppapi/thunk/ppb_file_ref_api.h b/ppapi/thunk/ppb_file_ref_api.h
index 4ec5314..ba92b63 100644
--- a/ppapi/thunk/ppb_file_ref_api.h
+++ b/ppapi/thunk/ppb_file_ref_api.h
@@ -5,6 +5,9 @@
#ifndef PPAPI_THUNK_PPB_FILE_REF_API_H_
#define PPAPI_THUNK_PPB_FILE_REF_API_H_
+#include <vector>
+
+#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
@@ -34,6 +37,24 @@ class PPAPI_THUNK_EXPORT PPB_FileRef_API {
scoped_refptr<TrackedCallback> callback) = 0;
virtual int32_t Query(PP_FileInfo* info,
scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t ReadDirectoryEntries(
+ const PP_ArrayOutput& output,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ // We define variants of Query and ReadDirectoryEntries because
+ // 1. we need to take linked_ptr instead of raw pointers to avoid
+ // use-after-free, and 2. we don't use PP_ArrayOutput for the
+ // communication between renderers and the browser in
+ // ReadDirectoryEntries. The *InHost functions must not be called in
+ // plugins, and Query and ReadDirectoryEntries must not be called in
+ // renderers.
+ // TODO(hamaji): These functions must be removed when we move
+ // FileRef to the new resource design. http://crbug.com/225441
+ virtual int32_t QueryInHost(linked_ptr<PP_FileInfo> info,
+ scoped_refptr<TrackedCallback> callback) = 0;
+ virtual int32_t ReadDirectoryEntriesInHost(
+ linked_ptr<std::vector<ppapi::PPB_FileRef_CreateInfo> > files,
+ linked_ptr<std::vector<PP_FileType> > file_types,
+ scoped_refptr<TrackedCallback> callback) = 0;
// Internal function for use in proxying. Returns the internal CreateInfo
// (the contained resource does not carry a ref on behalf of the caller).
diff --git a/ppapi/thunk/ppb_file_ref_thunk.cc b/ppapi/thunk/ppb_file_ref_thunk.cc
index 6a78c76..beb0e41 100644
--- a/ppapi/thunk/ppb_file_ref_thunk.cc
+++ b/ppapi/thunk/ppb_file_ref_thunk.cc
@@ -127,6 +127,16 @@ int32_t Query(PP_Resource file_ref,
enter.callback()));
}
+int32_t ReadDirectoryEntries(PP_Resource file_ref,
+ PP_ArrayOutput output,
+ PP_CompletionCallback callback) {
+ EnterFileRef enter(file_ref, callback, true);
+ if (enter.failed())
+ return enter.retval();
+ return enter.SetResult(enter.object()->ReadDirectoryEntries(
+ output, enter.callback()));
+}
+
PP_Var GetAbsolutePath(PP_Resource file_ref) {
VLOG(4) << "PPB_FileRef::GetAbsolutePath";
EnterFileRef enter(file_ref, true);
@@ -159,7 +169,8 @@ const PPB_FileRef_1_1 g_ppb_file_ref_thunk_1_1 = {
&Touch,
&Delete,
&Rename,
- &Query
+ &Query,
+ &ReadDirectoryEntries
};
const PPB_FileRefPrivate g_ppb_file_ref_private_thunk = {
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index 0581239..0eb4f83 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -43,8 +43,6 @@ class ResourceCreationAPI {
public:
virtual ~ResourceCreationAPI() {}
- virtual PP_Resource CreateDirectoryReader(PP_Instance instance,
- PP_Resource directory_ref) = 0;
virtual PP_Resource CreateFileIO(PP_Instance instance) = 0;
virtual PP_Resource CreateFileRef(PP_Instance instance,
PP_Resource file_system,