summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_flash_message_loop_proxy.h
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 09:19:17 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 09:19:17 +0000
commitcd2af395e8429a30bcee9e7ad7ec9f4b680c924d (patch)
treeacdc2fa6ef032a0c88b2a2f7729e15ae07a73254 /ppapi/proxy/ppb_flash_message_loop_proxy.h
parentbefff0575c078d9353e48a125575b429e4b8b5f1 (diff)
downloadchromium_src-cd2af395e8429a30bcee9e7ad7ec9f4b680c924d.zip
chromium_src-cd2af395e8429a30bcee9e7ad7ec9f4b680c924d.tar.gz
chromium_src-cd2af395e8429a30bcee9e7ad7ec9f4b680c924d.tar.bz2
Introduce PPB_Flash_MessageLoop interface for Pepper Flash.
Comparing with PPB_Flash.RunMessageLoop/QuitMessageLoop, this new interface avoids leaking nested message loops. If Quit() is not called to balance the call to Run(), the outermost message loop will be quitted when the resource is destroyed. BUG=109340 TEST=test_flash_message_loop.{h,cc} Review URL: http://codereview.chromium.org/9188045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_flash_message_loop_proxy.h')
-rw-r--r--ppapi/proxy/ppb_flash_message_loop_proxy.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/ppapi/proxy/ppb_flash_message_loop_proxy.h b/ppapi/proxy/ppb_flash_message_loop_proxy.h
new file mode 100644
index 0000000..aaf33f9
--- /dev/null
+++ b/ppapi/proxy/ppb_flash_message_loop_proxy.h
@@ -0,0 +1,52 @@
+// 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_PPB_FLASH_MESSAGE_LOOP_PROXY_H_
+#define PPAPI_PPB_FLASH_MESSAGE_LOOP_PROXY_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/proxy/interface_proxy.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+
+class HostResource;
+
+namespace proxy {
+
+class PPB_Flash_MessageLoop_Proxy
+ : public InterfaceProxy,
+ public base::SupportsWeakPtr<PPB_Flash_MessageLoop_Proxy> {
+ public:
+ explicit PPB_Flash_MessageLoop_Proxy(Dispatcher* dispatcher);
+ virtual ~PPB_Flash_MessageLoop_Proxy();
+
+ static PP_Resource CreateProxyResource(PP_Instance instance);
+
+ // InterfaceProxy implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+
+ private:
+ void OnMsgCreate(PP_Instance instance, ppapi::HostResource* resource);
+ void OnMsgRun(const ppapi::HostResource& flash_message_loop,
+ IPC::Message* reply);
+ void OnMsgQuit(const ppapi::HostResource& flash_message_loop);
+
+ void WillQuitSoon(scoped_ptr<IPC::Message> reply_message, int32_t result);
+
+ DISALLOW_COPY_AND_ASSIGN(PPB_Flash_MessageLoop_Proxy);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PPB_FLASH_MESSAGE_LOOP_PROXY_H_