| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PPAPI_PROXY_MESSAGE_HANDLER_H_ | 5 #ifndef PPAPI_PROXY_MESSAGE_HANDLER_H_ |
| 6 #define PPAPI_PROXY_MESSAGE_HANDLER_H_ | 6 #define PPAPI_PROXY_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // |user_data| is a pointer provided by the plugin that we pass back when we | 36 // |user_data| is a pointer provided by the plugin that we pass back when we |
| 37 // call functions in |handler_if|. | 37 // call functions in |handler_if|. |
| 38 // |message_loop| is the message loop where we will invoke functions in | 38 // |message_loop| is the message loop where we will invoke functions in |
| 39 // |handler_if|. Must not be the main thread message loop, | 39 // |handler_if|. Must not be the main thread message loop, |
| 40 // to try to force the plugin to not over-subscribe the main | 40 // to try to force the plugin to not over-subscribe the main |
| 41 // thread. If it's the main thread loop, |error| will be set | 41 // thread. If it's the main thread loop, |error| will be set |
| 42 // to PP_ERROR_WRONGTHREAD. | 42 // to PP_ERROR_WRONGTHREAD. |
| 43 // |error| is an out-param that will be set on failure. | 43 // |error| is an out-param that will be set on failure. |
| 44 static scoped_ptr<MessageHandler> Create( | 44 static scoped_ptr<MessageHandler> Create( |
| 45 PP_Instance instance, | 45 PP_Instance instance, |
| 46 const PPP_MessageHandler_0_1* handler_if, | 46 const PPP_MessageHandler_0_2* handler_if, |
| 47 void* user_data, | 47 void* user_data, |
| 48 PP_Resource message_loop, | 48 PP_Resource message_loop, |
| 49 int32_t* error); | 49 int32_t* error); |
| 50 ~MessageHandler(); | 50 ~MessageHandler(); |
| 51 | 51 |
| 52 bool LoopIsValid() const; | 52 bool LoopIsValid() const; |
| 53 | 53 |
| 54 void HandleMessage(ScopedPPVar var); | 54 void HandleMessage(ScopedPPVar var); |
| 55 void HandleBlockingMessage(ScopedPPVar var, | 55 void HandleBlockingMessage(ScopedPPVar var, |
| 56 scoped_ptr<IPC::Message> reply_msg); | 56 scoped_ptr<IPC::Message> reply_msg); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 MessageHandler(PP_Instance instance, | 59 MessageHandler(PP_Instance instance, |
| 60 const PPP_MessageHandler_0_1* handler_if, | 60 const PPP_MessageHandler_0_2* handler_if, |
| 61 void* user_data, | 61 void* user_data, |
| 62 scoped_refptr<MessageLoopResource> message_loop); | 62 scoped_refptr<MessageLoopResource> message_loop); |
| 63 | 63 |
| 64 PP_Instance instance_; | 64 PP_Instance instance_; |
| 65 const PPP_MessageHandler_0_1* handler_if_; | 65 const PPP_MessageHandler_0_2* handler_if_; |
| 66 void* user_data_; | 66 void* user_data_; |
| 67 scoped_refptr<MessageLoopResource> message_loop_; | 67 scoped_refptr<MessageLoopResource> message_loop_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(MessageHandler); | 69 DISALLOW_COPY_AND_ASSIGN(MessageHandler); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace proxy | 72 } // namespace proxy |
| 73 } // namespace ppapi | 73 } // namespace ppapi |
| 74 | 74 |
| 75 #endif // PPAPI_PROXY_MESSAGE_HANDLER_H_ | 75 #endif // PPAPI_PROXY_MESSAGE_HANDLER_H_ |
| OLD | NEW |