OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_HOST_RESOURCE_HOST_H_ | 5 #ifndef PPAPI_HOST_RESOURCE_HOST_H_ |
6 #define PPAPI_HOST_RESOURCE_HOST_H_ | 6 #define PPAPI_HOST_RESOURCE_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/host/ppapi_host_export.h" | 10 #include "ppapi/host/ppapi_host_export.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 PP_Instance pp_instance() const { return pp_instance_; } | 32 PP_Instance pp_instance() const { return pp_instance_; } |
33 PP_Resource pp_resource() const { return pp_resource_; } | 33 PP_Resource pp_resource() const { return pp_resource_; } |
34 | 34 |
35 // Handles messages associated with a given resource object. If the flags | 35 // Handles messages associated with a given resource object. If the flags |
36 // indicate that a response is required, the return value of this function | 36 // indicate that a response is required, the return value of this function |
37 // will be sent as a resource message "response" along with the message | 37 // will be sent as a resource message "response" along with the message |
38 // specified in the reply of the context. | 38 // specified in the reply of the context. |
39 // | 39 // |
40 // You can do a response asynchronously by returning PP_OK_COMPLETIONPENDING. | 40 // You can do a response asynchronously by returning PP_OK_COMPLETIONPENDING. |
41 // This will cause the reply to be skipped, and the class implementing this | 41 // This will cause the reply to be skipped, and the class implementing this |
42 // function will take responsibility for issuing the callback later. | 42 // function will take responsibility for issuing the callback. The callback |
| 43 // can be issued inside OnResourceMessageReceived before it returns, or at |
| 44 // a future time. |
43 // | 45 // |
44 // If you don't have a particular reply message, you can just ignore | 46 // If you don't have a particular reply message, you can just ignore |
45 // the reply in the message context. However, if you have a reply more than | 47 // the reply in the message context. However, if you have a reply more than |
46 // just the int32_t result code, set the reply to be the message of your | 48 // just the int32_t result code, set the reply to be the message of your |
47 // choosing. | 49 // choosing. |
48 // | 50 // |
49 // The default implementation just returns PP_ERROR_NOTSUPPORTED. | 51 // The default implementation just returns PP_ERROR_NOTSUPPORTED. |
50 virtual int32_t OnResourceMessageReceived(const IPC::Message& msg, | 52 virtual int32_t OnResourceMessageReceived(const IPC::Message& msg, |
51 HostMessageContext* context); | 53 HostMessageContext* context); |
52 | 54 |
53 private: | 55 private: |
54 // The host that owns this object. | 56 // The host that owns this object. |
55 PpapiHost* host_; | 57 PpapiHost* host_; |
56 | 58 |
57 PP_Instance pp_instance_; | 59 PP_Instance pp_instance_; |
58 PP_Resource pp_resource_; | 60 PP_Resource pp_resource_; |
59 | 61 |
60 DISALLOW_COPY_AND_ASSIGN(ResourceHost); | 62 DISALLOW_COPY_AND_ASSIGN(ResourceHost); |
61 }; | 63 }; |
62 | 64 |
63 } // namespace host | 65 } // namespace host |
64 } // namespace ppapi | 66 } // namespace ppapi |
65 | 67 |
66 #endif // PPAPI_HOST_RESOURCE_HOST_H_ | 68 #endif // PPAPI_HOST_RESOURCE_HOST_H_ |
OLD | NEW |