diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:41:46 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-15 20:41:46 +0000 |
commit | 7c85437ca6d8f1e16c0327a09eab3aa4cee4df1b (patch) | |
tree | 1a75b53cdf901b6a560bcf5ddbe84ec7a3e8c9c0 /ipc | |
parent | edd685f15dfd2841aaeddab567aea0623db1ae69 (diff) | |
download | chromium_src-7c85437ca6d8f1e16c0327a09eab3aa4cee4df1b.zip chromium_src-7c85437ca6d8f1e16c0327a09eab3aa4cee4df1b.tar.gz chromium_src-7c85437ca6d8f1e16c0327a09eab3aa4cee4df1b.tar.bz2 |
Create ipc.dll.
Review URL: http://codereview.chromium.org/7633042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/file_descriptor_set_posix.h | 4 | ||||
-rw-r--r-- | ipc/ipc.gyp | 1 | ||||
-rw-r--r-- | ipc/ipc.gypi | 10 | ||||
-rw-r--r-- | ipc/ipc_channel.h | 4 | ||||
-rw-r--r-- | ipc/ipc_channel_proxy.h | 4 | ||||
-rw-r--r-- | ipc/ipc_export.h | 29 | ||||
-rw-r--r-- | ipc/ipc_logging.h | 3 | ||||
-rw-r--r-- | ipc/ipc_message.h | 11 | ||||
-rw-r--r-- | ipc/ipc_message_utils.h | 43 | ||||
-rw-r--r-- | ipc/ipc_platform_file.h | 9 | ||||
-rw-r--r-- | ipc/ipc_switches.h | 8 | ||||
-rw-r--r-- | ipc/ipc_sync_channel.h | 4 | ||||
-rw-r--r-- | ipc/ipc_sync_message.h | 6 | ||||
-rw-r--r-- | ipc/ipc_sync_message_filter.h | 4 |
14 files changed, 90 insertions, 50 deletions
diff --git a/ipc/file_descriptor_set_posix.h b/ipc/file_descriptor_set_posix.h index cbd2428..1554c38 100644 --- a/ipc/file_descriptor_set_posix.h +++ b/ipc/file_descriptor_set_posix.h @@ -11,13 +11,15 @@ #include "base/basictypes.h" #include "base/file_descriptor_posix.h" #include "base/memory/ref_counted.h" +#include "ipc/ipc_export.h" // ----------------------------------------------------------------------------- // A FileDescriptorSet is an ordered set of POSIX file descriptors. These are // associated with IPC messages so that descriptors can be transmitted over a // UNIX domain socket. // ----------------------------------------------------------------------------- -class FileDescriptorSet : public base::RefCountedThreadSafe<FileDescriptorSet> { +class IPC_EXPORT FileDescriptorSet + : public base::RefCountedThreadSafe<FileDescriptorSet> { public: FileDescriptorSet(); diff --git a/ipc/ipc.gyp b/ipc/ipc.gyp index 8c045c9..ab57cd9 100644 --- a/ipc/ipc.gyp +++ b/ipc/ipc.gyp @@ -38,6 +38,7 @@ '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../base/base.gyp:test_support_base', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../testing/gtest.gyp:gtest', ], 'include_dirs': [ diff --git a/ipc/ipc.gypi b/ipc/ipc.gypi index 38aead2..7791934 100644 --- a/ipc/ipc.gypi +++ b/ipc/ipc.gypi @@ -22,6 +22,7 @@ 'ipc_channel_win.cc', 'ipc_channel_win.h', 'ipc_descriptors.h', + 'ipc_export.h', 'ipc_logging.cc', 'ipc_logging.h', 'ipc_message.cc', @@ -47,6 +48,9 @@ 'struct_constructor_macros.h', 'struct_destructor_macros.h', ], + 'defines': [ + 'IPC_IMPLEMENTATION', + ], 'include_dirs': [ '..', ], @@ -56,7 +60,7 @@ 'targets': [ { 'target_name': 'ipc', - 'type': 'static_library', + 'type': '<(component)', 'variables': { 'ipc_target': 1, }, @@ -78,13 +82,13 @@ 'targets': [ { 'target_name': 'ipc_win64', - 'type': 'static_library', + 'type': '<(component)', 'variables': { 'ipc_target': 1, }, 'dependencies': [ '../base/base.gyp:base_nacl_win64', - '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64', ], # TODO(gregoryd): direct_dependent_settings should be shared with the # 32-bit target, but it doesn't work due to a bug in gyp diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index f3bf78f..cd57b4b 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h @@ -29,13 +29,13 @@ namespace IPC { // the channel with the mode set to one of the NAMED modes. NAMED modes are // currently used by automation and service processes. -class Channel : public Message::Sender { +class IPC_EXPORT Channel : public Message::Sender { // Security tests need access to the pipe handle. friend class ChannelTest; public: // Implemented by consumers of a Channel to receive messages. - class Listener { + class IPC_EXPORT Listener { public: virtual ~Listener() {} diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index bcdeaac..0473e0c 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -47,14 +47,14 @@ class SendTask; // The consumer of IPC::ChannelProxy is responsible for allocating the Thread // instance where the IPC::Channel will be created and operated. // -class ChannelProxy : public Message::Sender { +class IPC_EXPORT ChannelProxy : public Message::Sender { public: struct MessageFilterTraits; // A class that receives messages on the thread where the IPC channel is // running. It can choose to prevent the default action for an IPC message. - class MessageFilter + class IPC_EXPORT MessageFilter : public base::RefCountedThreadSafe<MessageFilter, MessageFilterTraits> { public: MessageFilter(); diff --git a/ipc/ipc_export.h b/ipc/ipc_export.h new file mode 100644 index 0000000..f6c382a --- /dev/null +++ b/ipc/ipc_export.h @@ -0,0 +1,29 @@ +// Copyright (c) 2011 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 IPC_IPC_EXPORT_H_ +#define IPC_IPC_EXPORT_H_ +#pragma once + +// Defines IPC_EXPORT so that functionality implemented by the IPC module can be +// exported to consumers. + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(IPC_IMPLEMENTATION) +#define IPC_EXPORT __declspec(dllexport) +#else +#define IPC_EXPORT __declspec(dllimport) +#endif // defined(IPC_IMPLEMENTATION) + +#else // defined(WIN32) +#define IPC_EXPORT __attribute__((visibility("default"))) +#endif + +#else // defined(COMPONENT_BUILD) +#define IPC_EXPORT +#endif + +#endif // IPC_IPC_EXPORT_H_ diff --git a/ipc/ipc_logging.h b/ipc/ipc_logging.h index 07f6c65..42237c7 100644 --- a/ipc/ipc_logging.h +++ b/ipc/ipc_logging.h @@ -16,6 +16,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/message_loop.h" +#include "ipc/ipc_export.h" // Logging function. |name| is a string in ASCII and |params| is a string in // UTF-8. @@ -32,7 +33,7 @@ class Message; // One instance per process. Needs to be created on the main thread (the UI // thread in the browser) but OnPreDispatchMessage/OnPostDispatchMessage // can be called on other threads. -class Logging { +class IPC_EXPORT Logging { public: // Implemented by consumers of log messages. class Consumer { diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h index 8d367f2..b978cf2 100644 --- a/ipc/ipc_message.h +++ b/ipc/ipc_message.h @@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IPC_IPC_MESSAGE_H__ -#define IPC_IPC_MESSAGE_H__ +#ifndef IPC_IPC_MESSAGE_H_ +#define IPC_IPC_MESSAGE_H_ #pragma once #include <string> #include "base/basictypes.h" #include "base/pickle.h" +#include "ipc/ipc_export.h" #ifndef NDEBUG #define IPC_MESSAGE_LOG_ENABLED @@ -33,10 +34,10 @@ class Channel; class Message; struct LogData; -class Message : public Pickle { +class IPC_EXPORT Message : public Pickle { public: // Implemented by objects that can send IPC messages across a channel. - class Sender { + class IPC_EXPORT Sender { public: virtual ~Sender() {} @@ -280,4 +281,4 @@ enum SpecialRoutingIDs { #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging -#endif // IPC_IPC_MESSAGE_H__ +#endif // IPC_IPC_MESSAGE_H_ diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 7d444b5..ae7490c 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -197,7 +197,7 @@ struct ParamTraits<int> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadInt(iter, r); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; template <> @@ -209,7 +209,7 @@ struct ParamTraits<unsigned int> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadInt(iter, reinterpret_cast<int*>(r)); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; template <> @@ -221,7 +221,7 @@ struct ParamTraits<long> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadLong(iter, r); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; template <> @@ -233,7 +233,7 @@ struct ParamTraits<unsigned long> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadLong(iter, reinterpret_cast<long*>(r)); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; template <> @@ -245,7 +245,7 @@ struct ParamTraits<long long> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadInt64(iter, reinterpret_cast<int64*>(r)); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; template <> @@ -257,11 +257,11 @@ struct ParamTraits<unsigned long long> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadInt64(iter, reinterpret_cast<int64*>(r)); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; template <> -struct ParamTraits<unsigned short> { +struct IPC_EXPORT ParamTraits<unsigned short> { typedef unsigned short param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -316,7 +316,7 @@ struct ParamTraits<double> { }; template <> -struct ParamTraits<base::Time> { +struct IPC_EXPORT ParamTraits<base::Time> { typedef base::Time param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -324,7 +324,7 @@ struct ParamTraits<base::Time> { }; template <> -struct ParamTraits<base::TimeDelta> { +struct IPC_EXPORT ParamTraits<base::TimeDelta> { typedef base::TimeDelta param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -382,7 +382,7 @@ struct ParamTraits<MSG> { #endif // defined(OS_WIN) template <> -struct ParamTraits<base::DictionaryValue> { +struct IPC_EXPORT ParamTraits<base::DictionaryValue> { typedef base::DictionaryValue param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -390,7 +390,7 @@ struct ParamTraits<base::DictionaryValue> { }; template <> -struct ParamTraits<base::ListValue> { +struct IPC_EXPORT ParamTraits<base::ListValue> { typedef base::ListValue param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -584,7 +584,7 @@ struct ParamTraits<std::wstring> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadWString(iter, r); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; template <class A, class B> @@ -607,7 +607,7 @@ struct ParamTraits<std::pair<A, B> > { }; template <> -struct ParamTraits<NullableString16> { +struct IPC_EXPORT ParamTraits<NullableString16> { typedef NullableString16 param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -626,7 +626,7 @@ struct ParamTraits<string16> { static bool Read(const Message* m, void** iter, param_type* r) { return m->ReadString16(iter, r); } - static void Log(const param_type& p, std::string* l); + IPC_EXPORT static void Log(const param_type& p, std::string* l); }; #endif @@ -698,7 +698,7 @@ struct ParamTraits<POINT> { #endif // defined(OS_WIN) template <> -struct ParamTraits<FilePath> { +struct IPC_EXPORT ParamTraits<FilePath> { typedef FilePath param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -722,7 +722,7 @@ struct ParamTraits<FilePath> { // dup()ing any file descriptors to be transmitted and setting the |auto_close| // flag, which causes the file descriptor to be closed after writing. template<> -struct ParamTraits<base::FileDescriptor> { +struct IPC_EXPORT ParamTraits<base::FileDescriptor> { typedef base::FileDescriptor param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -734,7 +734,7 @@ struct ParamTraits<base::FileDescriptor> { // fact that IPC endpoints are handled specially on POSIX. See above comments // on FileDescriptor for more background. template<> -struct ParamTraits<IPC::ChannelHandle> { +struct IPC_EXPORT ParamTraits<IPC::ChannelHandle> { typedef ChannelHandle param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -767,7 +767,7 @@ struct ParamTraits<XFORM> { }; #endif // defined(OS_WIN) -struct LogData { +struct IPC_EXPORT LogData { LogData(); ~LogData(); @@ -785,7 +785,7 @@ struct LogData { }; template <> -struct ParamTraits<LogData> { +struct IPC_EXPORT ParamTraits<LogData> { typedef LogData param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* r); @@ -1077,8 +1077,9 @@ class MessageWithTuple : public Message { }; // defined in ipc_logging.cc -void GenerateLogData(const std::string& channel, const Message& message, - LogData* data); +IPC_EXPORT void GenerateLogData(const std::string& channel, + const Message& message, + LogData* data); #if defined(IPC_MESSAGE_LOG_ENABLED) diff --git a/ipc/ipc_platform_file.h b/ipc/ipc_platform_file.h index a99ed9d..daaf21c 100644 --- a/ipc/ipc_platform_file.h +++ b/ipc/ipc_platform_file.h @@ -7,9 +7,9 @@ #pragma once #include "base/basictypes.h" - #include "base/platform_file.h" #include "base/process.h" +#include "ipc/ipc_export.h" #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" @@ -41,9 +41,10 @@ inline base::PlatformFile PlatformFileForTransitToPlatformFile( } // Returns a file handle equivalent to |file| that can be used in |process|. -PlatformFileForTransit GetFileHandleForProcess(base::PlatformFile file, - base::ProcessHandle process, - bool close_source_handle); +IPC_EXPORT PlatformFileForTransit GetFileHandleForProcess( + base::PlatformFile file, + base::ProcessHandle process, + bool close_source_handle); } // namespace IPC diff --git a/ipc/ipc_switches.h b/ipc/ipc_switches.h index 1b754b4..7c7a833 100644 --- a/ipc/ipc_switches.h +++ b/ipc/ipc_switches.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -8,12 +8,12 @@ #define IPC_IPC_SWITCHES_H_ #pragma once -#include "base/base_switches.h" +#include "ipc/ipc_export.h" namespace switches { -extern const char kProcessChannelID[]; -extern const char kDebugChildren[]; +IPC_EXPORT extern const char kProcessChannelID[]; +IPC_EXPORT extern const char kDebugChildren[]; } // namespace switches diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h index e2d4c82..29844da 100644 --- a/ipc/ipc_sync_channel.h +++ b/ipc/ipc_sync_channel.h @@ -60,8 +60,8 @@ class MessageReplyDeserializer; // is more than this object. If the message loop goes away while this object // is running and it's used to send a message, then it will use the invalid // message loop pointer to proxy it to the ipc thread. -class SyncChannel : public ChannelProxy, - public base::WaitableEventWatcher::Delegate { +class IPC_EXPORT SyncChannel : public ChannelProxy, + public base::WaitableEventWatcher::Delegate { public: SyncChannel(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, diff --git a/ipc/ipc_sync_message.h b/ipc/ipc_sync_message.h index 149fd41..2c6ed8b 100644 --- a/ipc/ipc_sync_message.h +++ b/ipc/ipc_sync_message.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -21,7 +21,7 @@ namespace IPC { class MessageReplyDeserializer; -class SyncMessage : public Message { +class IPC_EXPORT SyncMessage : public Message { public: SyncMessage(int32 routing_id, uint32 type, PriorityValue priority, MessageReplyDeserializer* deserializer); @@ -81,7 +81,7 @@ class SyncMessage : public Message { }; // Used to deserialize parameters from a reply to a synchronous message -class MessageReplyDeserializer { +class IPC_EXPORT MessageReplyDeserializer { public: virtual ~MessageReplyDeserializer() {} bool SerializeOutputParameters(const Message& msg); diff --git a/ipc/ipc_sync_message_filter.h b/ipc/ipc_sync_message_filter.h index c313460..0dc471a 100644 --- a/ipc/ipc_sync_message_filter.h +++ b/ipc/ipc_sync_message_filter.h @@ -28,8 +28,8 @@ class MessageReplyDeserializer; // support fancy features that SyncChannel does, such as handling recursion or // receiving messages while waiting for a response. Note that this object can // be used to send simultaneous synchronous messages from different threads. -class SyncMessageFilter : public ChannelProxy::MessageFilter, - public Message::Sender { +class IPC_EXPORT SyncMessageFilter : public ChannelProxy::MessageFilter, + public Message::Sender { public: explicit SyncMessageFilter(base::WaitableEvent* shutdown_event); virtual ~SyncMessageFilter(); |