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

Unified Diff: ppapi/proxy/ppb_flash_file_proxy.cc

Issue 7874002: This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | « ppapi/proxy/ppb_flash_file_proxy.h ('k') | ppapi/proxy/ppb_flash_menu_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_flash_file_proxy.cc
===================================================================
--- ppapi/proxy/ppb_flash_file_proxy.cc (revision 100758)
+++ ppapi/proxy/ppb_flash_file_proxy.cc (working copy)
@@ -501,17 +501,22 @@
&FreeDirContents,
};
-InterfaceProxy* CreateFlashFileModuleLocalProxy(Dispatcher* dispatcher,
- const void* target_interface) {
- return new PPB_Flash_File_ModuleLocal_Proxy(dispatcher, target_interface);
+InterfaceProxy* CreateFlashFileModuleLocalProxy(Dispatcher* dispatcher) {
+ return new PPB_Flash_File_ModuleLocal_Proxy(dispatcher);
}
} // namespace
PPB_Flash_File_ModuleLocal_Proxy::PPB_Flash_File_ModuleLocal_Proxy(
- Dispatcher* dispatcher,
- const void* target_interface)
- : InterfaceProxy(dispatcher, target_interface) {
+ Dispatcher* dispatcher)
+ : InterfaceProxy(dispatcher),
+ ppb_flash_file_module_local_impl_(NULL) {
+ if (!dispatcher->IsPlugin()) {
+ ppb_flash_file_module_local_impl_ =
+ static_cast<const PPB_Flash_File_ModuleLocal*>(
+ dispatcher->local_get_interface()(
+ PPB_FLASH_FILE_MODULELOCAL_INTERFACE));
+ }
}
PPB_Flash_File_ModuleLocal_Proxy::~PPB_Flash_File_ModuleLocal_Proxy() {
@@ -558,8 +563,8 @@
IPC::PlatformFileForTransit* file_handle,
int32_t* result) {
base::PlatformFile file;
- *result = ppb_flash_file_module_local_target()->
- OpenFile(instance, path.c_str(), mode, &file);
+ *result = ppb_flash_file_module_local_impl_->OpenFile(
+ instance, path.c_str(), mode, &file);
*file_handle = PlatformFileToPlatformFileForTransit(
dispatcher(), result, file);
}
@@ -569,8 +574,8 @@
const std::string& from_path,
const std::string& to_path,
int32_t* result) {
- *result = ppb_flash_file_module_local_target()->
- RenameFile(instance, from_path.c_str(), to_path.c_str());
+ *result = ppb_flash_file_module_local_impl_->RenameFile(
+ instance, from_path.c_str(), to_path.c_str());
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgDeleteFileOrDir(
@@ -578,23 +583,23 @@
const std::string& path,
PP_Bool recursive,
int32_t* result) {
- *result = ppb_flash_file_module_local_target()->
- DeleteFileOrDir(instance, path.c_str(), recursive);
+ *result = ppb_flash_file_module_local_impl_->DeleteFileOrDir(
+ instance, path.c_str(), recursive);
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgCreateDir(PP_Instance instance,
const std::string& path,
int32_t* result) {
- *result = ppb_flash_file_module_local_target()->
- CreateDir(instance, path.c_str());
+ *result = ppb_flash_file_module_local_impl_->CreateDir(
+ instance, path.c_str());
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgQueryFile(PP_Instance instance,
const std::string& path,
PP_FileInfo* info,
int32_t* result) {
- *result = ppb_flash_file_module_local_target()->
- QueryFile(instance, path.c_str(), info);
+ *result = ppb_flash_file_module_local_impl_->QueryFile(
+ instance, path.c_str(), info);
}
void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents(
@@ -603,8 +608,8 @@
std::vector<SerializedDirEntry>* entries,
int32_t* result) {
PP_DirContents_Dev* contents = NULL;
- *result = ppb_flash_file_module_local_target()->
- GetDirContents(instance, path.c_str(), &contents);
+ *result = ppb_flash_file_module_local_impl_->GetDirContents(
+ instance, path.c_str(), &contents);
if (*result != PP_OK)
return;
@@ -614,7 +619,7 @@
(*entries)[i].name.assign(contents->entries[i].name);
(*entries)[i].is_dir = PP_ToBool(contents->entries[i].is_dir);
}
- ppb_flash_file_module_local_target()->FreeDirContents(instance, contents);
+ ppb_flash_file_module_local_impl_->FreeDirContents(instance, contents);
}
// PPB_Flash_File_FileRef ------------------------------------------------------
@@ -665,17 +670,20 @@
&QueryFileRefFile,
};
-InterfaceProxy* CreateFlashFileFileRefProxy(Dispatcher* dispatcher,
- const void* target_interface) {
- return new PPB_Flash_File_FileRef_Proxy(dispatcher, target_interface);
+InterfaceProxy* CreateFlashFileFileRefProxy(Dispatcher* dispatcher) {
+ return new PPB_Flash_File_FileRef_Proxy(dispatcher);
}
} // namespace
PPB_Flash_File_FileRef_Proxy::PPB_Flash_File_FileRef_Proxy(
- Dispatcher* dispatcher,
- const void* target_interface)
- : InterfaceProxy(dispatcher, target_interface) {
+ Dispatcher* dispatcher)
+ : InterfaceProxy(dispatcher),
+ ppb_flash_file_fileref_impl_(NULL) {
+ if (!dispatcher->IsPlugin()) {
+ ppb_flash_file_fileref_impl_ = static_cast<const PPB_Flash_File_FileRef*>(
+ dispatcher->local_get_interface()(PPB_FLASH_FILE_FILEREF_INTERFACE));
+ }
}
PPB_Flash_File_FileRef_Proxy::~PPB_Flash_File_FileRef_Proxy() {
@@ -713,8 +721,8 @@
IPC::PlatformFileForTransit* file_handle,
int32_t* result) {
base::PlatformFile file;
- *result = ppb_flash_file_module_local_target()->
- OpenFile(host_resource.host_resource(), mode, &file);
+ *result = ppb_flash_file_fileref_impl_->OpenFile(
+ host_resource.host_resource(), mode, &file);
*file_handle = PlatformFileToPlatformFileForTransit(
dispatcher(), result, file);
}
@@ -723,8 +731,8 @@
const HostResource& host_resource,
PP_FileInfo* info,
int32_t* result) {
- *result = ppb_flash_file_module_local_target()->
- QueryFile(host_resource.host_resource(), info);
+ *result = ppb_flash_file_fileref_impl_->QueryFile(
+ host_resource.host_resource(), info);
}
} // namespace proxy
« no previous file with comments | « ppapi/proxy/ppb_flash_file_proxy.h ('k') | ppapi/proxy/ppb_flash_menu_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698