OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_CHILD_NPAPI_NP_CHANNEL_BASE_H_ | 5 #ifndef CONTENT_CHILD_NPAPI_NP_CHANNEL_BASE_H_ |
6 #define CONTENT_CHILD_NPAPI_NP_CHANNEL_BASE_H_ | 6 #define CONTENT_CHILD_NPAPI_NP_CHANNEL_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/process/process.h" | 14 #include "base/process/process.h" |
15 #include "content/child/npapi/npobject_base.h" | 15 #include "content/child/npapi/npobject_base.h" |
16 #include "content/common/message_router.h" | 16 #include "content/common/message_router.h" |
17 #include "ipc/ipc_channel_handle.h" | 17 #include "ipc/ipc_channel_handle.h" |
18 #include "ipc/ipc_sync_channel.h" | 18 #include "ipc/ipc_sync_channel.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class MessageLoopProxy; | 21 class MessageLoopProxy; |
22 } | 22 } |
23 | 23 |
24 #if defined(COMPILER_GCC) | |
25 namespace BASE_HASH_NAMESPACE { | |
26 | |
27 template<> | |
28 struct hash<NPObject*> { | |
29 std::size_t operator()(NPObject* const& ptr) const { | |
30 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | |
31 } | |
32 }; | |
33 | |
34 template<> | |
35 struct hash<struct _NPP*> { | |
36 std::size_t operator()(struct _NPP* const& ptr) const { | |
37 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | |
38 } | |
39 }; | |
40 | |
41 } // namespace __gnu_cxx | |
42 #elif defined(COMPILER_MSVC) | |
43 namespace stdext { | |
44 | |
45 template<> | |
46 inline size_t hash_value(NPObject* const& ptr) { | |
47 return hash_value(reinterpret_cast<size_t>(ptr)); | |
48 } | |
49 | |
50 } // namespace stdext | |
51 #endif // COMPILER | |
52 | |
53 namespace content { | 24 namespace content { |
54 | 25 |
55 // Encapsulates an IPC channel between a renderer and another process. Used to | 26 // Encapsulates an IPC channel between a renderer and another process. Used to |
56 // proxy access to NP objects. | 27 // proxy access to NP objects. |
57 class NPChannelBase : public IPC::Listener, | 28 class NPChannelBase : public IPC::Listener, |
58 public IPC::Sender, | 29 public IPC::Sender, |
59 public base::RefCountedThreadSafe<NPChannelBase> { | 30 public base::RefCountedThreadSafe<NPChannelBase> { |
60 public: | 31 public: |
61 | 32 |
62 // WebPlugin[Delegate] call these on construction and destruction to setup | 33 // WebPlugin[Delegate] call these on construction and destruction to setup |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // have the unblock flag set, since they could be followed by a sync message | 186 // have the unblock flag set, since they could be followed by a sync message |
216 // that won't get dispatched until the call to the renderer is complete. | 187 // that won't get dispatched until the call to the renderer is complete. |
217 bool send_unblocking_only_during_unblock_dispatch_; | 188 bool send_unblocking_only_during_unblock_dispatch_; |
218 | 189 |
219 DISALLOW_COPY_AND_ASSIGN(NPChannelBase); | 190 DISALLOW_COPY_AND_ASSIGN(NPChannelBase); |
220 }; | 191 }; |
221 | 192 |
222 } // namespace content | 193 } // namespace content |
223 | 194 |
224 #endif // CONTENT_CHILD_NPAPI_NP_CHANNEL_BASE_H_ | 195 #endif // CONTENT_CHILD_NPAPI_NP_CHANNEL_BASE_H_ |
OLD | NEW |