| 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_MESSAGE_FILTER_H_ | 5 #ifndef PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_ |
| 6 #define PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_ | 6 #define PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ppapi/c/pp_stdint.h" | 9 #include "ppapi/c/pp_stdint.h" |
| 10 #include "ppapi/host/host_message_context.h" | 10 #include "ppapi/host/host_message_context.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 virtual bool HandleMessage(const IPC::Message& msg, | 99 virtual bool HandleMessage(const IPC::Message& msg, |
| 100 HostMessageContext* context) OVERRIDE; | 100 HostMessageContext* context) OVERRIDE; |
| 101 | 101 |
| 102 // This can be called from any thread. | 102 // This can be called from any thread. |
| 103 virtual void SendReply(const ReplyMessageContext& context, | 103 virtual void SendReply(const ReplyMessageContext& context, |
| 104 const IPC::Message& msg) OVERRIDE; | 104 const IPC::Message& msg) OVERRIDE; |
| 105 | 105 |
| 106 protected: | 106 protected: |
| 107 virtual ~ResourceMessageFilter(); | 107 virtual ~ResourceMessageFilter(); |
| 108 | 108 |
| 109 // Please see the comments of |resource_host_| for on which thread it can be |
| 110 // used and when it is NULL. |
| 111 ResourceHost* resource_host() const { return resource_host_; } |
| 112 |
| 109 // If you want the message to be handled on another thread, return a non-null | 113 // If you want the message to be handled on another thread, return a non-null |
| 110 // task runner which will target tasks accordingly. | 114 // task runner which will target tasks accordingly. |
| 111 virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( | 115 virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( |
| 112 const IPC::Message& message); | 116 const IPC::Message& message); |
| 113 | 117 |
| 114 private: | 118 private: |
| 115 friend class base::DeleteHelper<ResourceMessageFilter>; | 119 friend class base::DeleteHelper<ResourceMessageFilter>; |
| 116 friend class base::RefCountedThreadSafe< | 120 friend class base::RefCountedThreadSafe< |
| 117 ResourceMessageFilter, internal::ResourceMessageFilterDeleteTraits>; | 121 ResourceMessageFilter, internal::ResourceMessageFilterDeleteTraits>; |
| 118 friend struct internal::ResourceMessageFilterDeleteTraits; | 122 friend struct internal::ResourceMessageFilterDeleteTraits; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 136 // is destroyed, |OnFilterDestroyed| is called and this will be set to NULL. | 140 // is destroyed, |OnFilterDestroyed| is called and this will be set to NULL. |
| 137 ResourceHost* resource_host_; | 141 ResourceHost* resource_host_; |
| 138 | 142 |
| 139 DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter); | 143 DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter); |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 } // namespace host | 146 } // namespace host |
| 143 } // namespace ppapi | 147 } // namespace ppapi |
| 144 | 148 |
| 145 #endif // PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_ | 149 #endif // PPAPI_HOST_RESOURCE_MESSAGE_FILTER_H_ |
| OLD | NEW |