diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 03:31:30 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-13 03:31:30 +0000 |
commit | 7937c488c70c060f4f6a379c03d9c8c62733e5fa (patch) | |
tree | 7a19202d3718d86320e496eca0f77019354e4f9a /ppapi/proxy/ppb_flash_clipboard_proxy.cc | |
parent | 6569dad2bd6c330ce6cf006cc952feecd57b0f87 (diff) | |
download | chromium_src-7937c488c70c060f4f6a379c03d9c8c62733e5fa.zip chromium_src-7937c488c70c060f4f6a379c03d9c8c62733e5fa.tar.gz chromium_src-7937c488c70c060f4f6a379c03d9c8c62733e5fa.tar.bz2 |
This patch tries to remove most of the manual registration for Pepper interfaces, and replaces it with a list of macros. When files want to know which Pepper interface names and structs there are, they define what they want to do with the macros, and then include the relevant files for the classes of interfaces they want (stable, private, dev).
This re-lands my previous change.
Original Review URL: http://codereview.chromium.org/7740038
This does not convert all the dev interfaces. I just did a few to keep the patch smaller. So there is still a lot of manual registration.
This fixes the previous design problem where we assumed one *_Proxy object == one interface. We have been hacking around this lately with duplicate GetInfo calls, but this doesn't work for PPP interfaces.
Now, a _Proxy object is just there to help keep things organized. One proxy can handle zero, one, or many interfaces, and this mapping is controlled by just one line in the interfaces file.
So for example, to add a new function to a new version of an interface with backward compatibility, you would add that function to the _api.h file, and write a thunk for the new interface. Then you only need to add one line to the interfaces_ppb_public_stable.h file and that will be hooked up with the proxy and the implementation.
This removes some _proxy objects/files that were used only to declare that the interfaces existed, since they're no longer necessary.
I folded Console into the Instance API which removed a bunch of code.
I removed FileChooser 0.4. I think everybody has converted to the new one, and I think parts of it weren't even hooked up properly anymore.
Review URL: http://codereview.chromium.org/7874002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100851 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_flash_clipboard_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_flash_clipboard_proxy.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/ppapi/proxy/ppb_flash_clipboard_proxy.cc b/ppapi/proxy/ppb_flash_clipboard_proxy.cc index 38e3e5b..18918fc 100644 --- a/ppapi/proxy/ppb_flash_clipboard_proxy.cc +++ b/ppapi/proxy/ppb_flash_clipboard_proxy.cc @@ -88,16 +88,19 @@ const PPB_Flash_Clipboard flash_clipboard_interface = { &WritePlainText }; -InterfaceProxy* CreateFlashClipboardProxy(Dispatcher* dispatcher, - const void* target_interface) { - return new PPB_Flash_Clipboard_Proxy(dispatcher, target_interface); +InterfaceProxy* CreateFlashClipboardProxy(Dispatcher* dispatcher) { + return new PPB_Flash_Clipboard_Proxy(dispatcher); } } // namespace -PPB_Flash_Clipboard_Proxy::PPB_Flash_Clipboard_Proxy( - Dispatcher* dispatcher, const void* target_interface) - : InterfaceProxy(dispatcher, target_interface) { +PPB_Flash_Clipboard_Proxy::PPB_Flash_Clipboard_Proxy(Dispatcher* dispatcher) + : InterfaceProxy(dispatcher), + ppb_flash_clipboard_impl_(NULL) { + if (!dispatcher->IsPlugin()) { + ppb_flash_clipboard_impl_ = static_cast<const PPB_Flash_Clipboard*>( + dispatcher->local_get_interface()(PPB_FLASH_CLIPBOARD_INTERFACE)); + } } PPB_Flash_Clipboard_Proxy::~PPB_Flash_Clipboard_Proxy() { @@ -134,7 +137,7 @@ void PPB_Flash_Clipboard_Proxy::OnMsgIsFormatAvailable( int clipboard_type, int format, bool* result) { - *result = PP_ToBool(ppb_flash_clipboard_target()->IsFormatAvailable( + *result = PP_ToBool(ppb_flash_clipboard_impl_->IsFormatAvailable( instance_id, static_cast<PP_Flash_Clipboard_Type>(clipboard_type), static_cast<PP_Flash_Clipboard_Format>(format))); @@ -145,7 +148,7 @@ void PPB_Flash_Clipboard_Proxy::OnMsgReadPlainText( int clipboard_type, SerializedVarReturnValue result) { result.Return(dispatcher(), - ppb_flash_clipboard_target()->ReadPlainText( + ppb_flash_clipboard_impl_->ReadPlainText( instance_id, static_cast<PP_Flash_Clipboard_Type>(clipboard_type))); } @@ -154,7 +157,7 @@ void PPB_Flash_Clipboard_Proxy::OnMsgWritePlainText( PP_Instance instance_id, int clipboard_type, SerializedVarReceiveInput text) { - int32_t result = ppb_flash_clipboard_target()->WritePlainText( + int32_t result = ppb_flash_clipboard_impl_->WritePlainText( instance_id, static_cast<PP_Flash_Clipboard_Type>(clipboard_type), text.Get(dispatcher())); |