Skip to content

Commit

Permalink
Create ipc.dll.
Browse files Browse the repository at this point in the history
Review URL: http://codereview.chromium.org/7633042

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96820 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
darin@chromium.org committed Aug 15, 2011
1 parent edd685f commit 7c85437
Show file tree
Hide file tree
Showing 18 changed files with 94 additions and 51 deletions.
2 changes: 1 addition & 1 deletion base/synchronization/waitable_event_watcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class BASE_EXPORT WaitableEventWatcher
WaitableEventWatcher();
virtual ~WaitableEventWatcher();

class Delegate {
class BASE_EXPORT Delegate {
public:
virtual ~Delegate() { }

Expand Down
1 change: 1 addition & 0 deletions content/browser/plugin_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <vector>

#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <utility> // for pair<>
#endif

#include "base/base_switches.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/logging.h"
Expand Down
1 change: 1 addition & 0 deletions content/browser/worker_host/worker_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <set>
#include <vector>

#include "base/base_switches.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/message_loop.h"
Expand Down
4 changes: 3 additions & 1 deletion ipc/file_descriptor_set_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
1 change: 1 addition & 0 deletions ipc/ipc.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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': [
Expand Down
10 changes: 7 additions & 3 deletions ipc/ipc.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -47,6 +48,9 @@
'struct_constructor_macros.h',
'struct_destructor_macros.h',
],
'defines': [
'IPC_IMPLEMENTATION',
],
'include_dirs': [
'..',
],
Expand All @@ -56,7 +60,7 @@
'targets': [
{
'target_name': 'ipc',
'type': 'static_library',
'type': '<(component)',
'variables': {
'ipc_target': 1,
},
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ipc/ipc_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

Expand Down
4 changes: 2 additions & 2 deletions ipc/ipc_channel_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
29 changes: 29 additions & 0 deletions ipc/ipc_export.h
Original file line number Diff line number Diff line change
@@ -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_
3 changes: 2 additions & 1 deletion ipc/ipc_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down
11 changes: 6 additions & 5 deletions ipc/ipc_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {}

Expand Down Expand Up @@ -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_
43 changes: 22 additions & 21 deletions ipc/ipc_message_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <>
Expand All @@ -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 <>
Expand All @@ -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 <>
Expand All @@ -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 <>
Expand All @@ -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 <>
Expand All @@ -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);
Expand Down Expand Up @@ -316,15 +316,15 @@ 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);
static void Log(const param_type& p, std::string* l);
};

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);
Expand Down Expand Up @@ -382,15 +382,15 @@ 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);
static void Log(const param_type& p, std::string* l);
};

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);
Expand Down Expand Up @@ -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>
Expand All @@ -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);
Expand All @@ -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

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -767,7 +767,7 @@ struct ParamTraits<XFORM> {
};
#endif // defined(OS_WIN)

struct LogData {
struct IPC_EXPORT LogData {
LogData();
~LogData();

Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 7c85437

Please sign in to comment.