summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 23:48:34 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 23:48:34 +0000
commitdc90da2c3f8c87baa8dcea7fbf0272001d771ecf (patch)
tree99baf8465918e25521eab024315a5aa9ce78734d /chrome
parentbf1b47dfbe8294738c0db628af036e2fd363ddac (diff)
downloadchromium_src-dc90da2c3f8c87baa8dcea7fbf0272001d771ecf.zip
chromium_src-dc90da2c3f8c87baa8dcea7fbf0272001d771ecf.tar.gz
chromium_src-dc90da2c3f8c87baa8dcea7fbf0272001d771ecf.tar.bz2
* Add ipc_tests unittest target to xcode project.
* Stub out ipc_channel_posix.cc to allow other code that depends on it to be compiled. * Cleanup some ipc code a bit to compile on gcc. * Remove unused IPC::Channel::ProcessPendingMessages() git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj217
-rw-r--r--chrome/common/ipc_channel.cc36
-rw-r--r--chrome/common/ipc_channel.h28
-rw-r--r--chrome/common/ipc_channel_posix.cc32
-rw-r--r--chrome/common/ipc_channel_proxy.h2
-rw-r--r--chrome/common/ipc_fuzzing_tests.cc19
-rw-r--r--chrome/common/ipc_message_utils.h16
-rw-r--r--chrome/common/ipc_sync_message.h9
-rw-r--r--chrome/common/ipc_tests.cc25
-rw-r--r--chrome/common/ipc_tests.h4
10 files changed, 317 insertions, 71 deletions
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 8e9798e..5b08bf2 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -140,6 +140,19 @@
4DDC64580EAE394200FB5EBE /* libzlib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DDC64550EAE392400FB5EBE /* libzlib.a */; };
B54BD8FC0ED622C00093FD54 /* mach_message_source_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = B54BD8FA0ED622C00093FD54 /* mach_message_source_mac.cc */; };
B562C8430ED49C830077A23F /* mach_ipc_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B562C8420ED49C830077A23F /* mach_ipc_mac.mm */; };
+ B5FDBFB80EE4627100BEC6E6 /* ipc_tests.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBBE0E9D4C9F009A6919 /* ipc_tests.cc */; };
+ B5FDC0580EE488E500BEC6E6 /* ipc_channel_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5FDC0570EE488E500BEC6E6 /* ipc_channel_posix.cc */; };
+ B5FDC1C90EE48ADB00BEC6E6 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF7A0E9D5449009A6919 /* AppKit.framework */; };
+ B5FDC1CA0EE48ADB00BEC6E6 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDD10E9D5295009A6919 /* CoreFoundation.framework */; };
+ B5FDC1CB0EE48ADB00BEC6E6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE820E9D532E009A6919 /* Foundation.framework */; };
+ B5FDC1CC0EE48ADB00BEC6E6 /* libbase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFDC70E9D525B009A6919 /* libbase.a */; };
+ B5FDC1D00EE48ADB00BEC6E6 /* libcommon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFC1A0E9D4CB9009A6919 /* libcommon.a */; };
+ B5FDC1D10EE48ADB00BEC6E6 /* libevent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF4B0E9D53B4009A6919 /* libevent.a */; };
+ B5FDC1D30EE48ADB00BEC6E6 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFF410E9D538D009A6919 /* libgtest.a */; };
+ B5FDC1D40EE48ADB00BEC6E6 /* libicudata.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE690E9D52DC009A6919 /* libicudata.a */; };
+ B5FDC1D60EE48ADB00BEC6E6 /* libicuuc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE710E9D52DC009A6919 /* libicuuc.a */; };
+ B5FDC1E50EE48B1600BEC6E6 /* ipc_fuzzing_tests.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBAD0E9D4C9F009A6919 /* ipc_fuzzing_tests.cc */; };
+ B5FDC2180EE48F4100BEC6E6 /* libicui18n.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D7BFE6D0E9D52DC009A6919 /* libicui18n.a */; };
E48FB9590EC4E9C10052B72B /* safe_browsing_database_bloom.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFADF0E9D49DE009A6919 /* safe_browsing_database_bloom.cc */; };
E48FB95C0EC4E9DD0052B72B /* safe_browsing_database_impl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFAE10E9D49DE009A6919 /* safe_browsing_database_impl.cc */; };
E48FB9760EC4EA320052B72B /* url_request_failed_dns_job.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48FB96E0EC4EA270052B72B /* url_request_failed_dns_job.cc */; };
@@ -500,6 +513,55 @@
remoteGlobalIDString = D2AAC045055464E500DB518D;
remoteInfo = zlib;
};
+ B5067F5A0EE4936200CC5024 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 7BD53EA50D6F6FC7003CD41E;
+ remoteInfo = icui18n;
+ };
+ B5067F5C0EE4936A00CC5024 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4D7BFDBE0E9D525B009A6919 /* base.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 825402BA0D92D0FA0006B936;
+ remoteInfo = base;
+ };
+ B5067F5E0EE4937A00CC5024 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4D7BFF460E9D53B4009A6919 /* libevent.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 7B262E830E82E5D7001CE27F;
+ remoteInfo = libevent;
+ };
+ B5067F600EE4937F00CC5024 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4D7BFF3C0E9D538D009A6919 /* gtest.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D;
+ remoteInfo = gtest;
+ };
+ B5067F620EE4938E00CC5024 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 82C262C30DCF9411005CFE91;
+ remoteInfo = icudata;
+ };
+ B5067F640EE4938E00CC5024 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4D7BFE5B0E9D52DC009A6919 /* icu.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 7BD53AAA0D6F6671003CD41E;
+ remoteInfo = icuuc;
+ };
+ B5FDBFB30EE4625B00BEC6E6 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 4D7BF2E90E9D46A4009A6919 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4D7BFC190E9D4CB9009A6919;
+ remoteInfo = common;
+ };
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -1236,6 +1298,8 @@
B54BD8FB0ED622C00093FD54 /* mach_message_source_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mach_message_source_mac.h; sourceTree = "<group>"; };
B562C8410ED49C830077A23F /* mach_ipc_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mach_ipc_mac.h; sourceTree = "<group>"; };
B562C8420ED49C830077A23F /* mach_ipc_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = mach_ipc_mac.mm; sourceTree = "<group>"; };
+ B5FDBFAE0EE4623000BEC6E6 /* ipc_tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ipc_tests; sourceTree = BUILT_PRODUCTS_DIR; };
+ B5FDC0570EE488E500BEC6E6 /* ipc_channel_posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ipc_channel_posix.cc; sourceTree = "<group>"; };
E48FB9610EC4EA270052B72B /* automation_autocomplete_edit_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_autocomplete_edit_tracker.h; sourceTree = "<group>"; };
E48FB9620EC4EA270052B72B /* automation_browser_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_browser_tracker.h; sourceTree = "<group>"; };
E48FB9630EC4EA270052B72B /* automation_constrained_window_tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = automation_constrained_window_tracker.h; sourceTree = "<group>"; };
@@ -1309,6 +1373,23 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ B5FDBFAC0EE4623000BEC6E6 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B5FDC1C90EE48ADB00BEC6E6 /* AppKit.framework in Frameworks */,
+ B5FDC1CA0EE48ADB00BEC6E6 /* CoreFoundation.framework in Frameworks */,
+ B5FDC1CB0EE48ADB00BEC6E6 /* Foundation.framework in Frameworks */,
+ B5FDC1CC0EE48ADB00BEC6E6 /* libbase.a in Frameworks */,
+ B5FDC1D00EE48ADB00BEC6E6 /* libcommon.a in Frameworks */,
+ B5FDC2180EE48F4100BEC6E6 /* libicui18n.a in Frameworks */,
+ B5FDC1D40EE48ADB00BEC6E6 /* libicudata.a in Frameworks */,
+ B5FDC1D60EE48ADB00BEC6E6 /* libicuuc.a in Frameworks */,
+ B5FDC1D10EE48ADB00BEC6E6 /* libevent.a in Frameworks */,
+ B5FDC1D30EE48ADB00BEC6E6 /* libgtest.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -1433,6 +1514,7 @@
4D7BFC1A0E9D4CB9009A6919 /* libcommon.a */,
4D640CEB0EAE86BD00EBCFC0 /* librenderer.a */,
4D7BFB2D0E9D4BE5009A6919 /* unit_tests */,
+ B5FDBFAE0EE4623000BEC6E6 /* ipc_tests */,
);
name = Products;
sourceTree = "<group>";
@@ -2057,6 +2139,7 @@
4D7BFBA80E9D4C9F009A6919 /* gears_api.h */,
4D7BFBA90E9D4C9F009A6919 /* ipc_channel.cc */,
4D7BFBAA0E9D4C9F009A6919 /* ipc_channel.h */,
+ B5FDC0570EE488E500BEC6E6 /* ipc_channel_posix.cc */,
4D7BFBAB0E9D4C9F009A6919 /* ipc_channel_proxy.cc */,
4D7BFBAC0E9D4C9F009A6919 /* ipc_channel_proxy.h */,
4D7BFBAD0E9D4C9F009A6919 /* ipc_fuzzing_tests.cc */,
@@ -2450,6 +2533,29 @@
productReference = 4D7BFC1A0E9D4CB9009A6919 /* libcommon.a */;
productType = "com.apple.product-type.library.static";
};
+ B5FDBFAD0EE4623000BEC6E6 /* ipc_tests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = B5FDBFB20EE4625600BEC6E6 /* Build configuration list for PBXNativeTarget "ipc_tests" */;
+ buildPhases = (
+ B5FDBFAB0EE4623000BEC6E6 /* Sources */,
+ B5FDBFAC0EE4623000BEC6E6 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ B5067F5D0EE4936A00CC5024 /* PBXTargetDependency */,
+ B5FDBFB40EE4625B00BEC6E6 /* PBXTargetDependency */,
+ B5067F610EE4937F00CC5024 /* PBXTargetDependency */,
+ B5067F5B0EE4936200CC5024 /* PBXTargetDependency */,
+ B5067F630EE4938E00CC5024 /* PBXTargetDependency */,
+ B5067F650EE4938E00CC5024 /* PBXTargetDependency */,
+ B5067F5F0EE4937A00CC5024 /* PBXTargetDependency */,
+ );
+ name = ipc_tests;
+ productName = ipc_tests;
+ productReference = B5FDBFAE0EE4623000BEC6E6 /* ipc_tests */;
+ productType = "com.apple.product-type.tool";
+ };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -2523,6 +2629,7 @@
4D640CEA0EAE86BD00EBCFC0 /* renderer */,
4D7BFB2C0E9D4BE5009A6919 /* unit_tests */,
4D7B014C0E9D572C009A6919 /* run_unit_tests */,
+ B5FDBFAD0EE4623000BEC6E6 /* ipc_tests */,
);
};
/* End PBXProject section */
@@ -2837,6 +2944,7 @@
4D7BFCCE0E9D4D7A009A6919 /* cookie_monster_sqlite.cc in Sources */,
4D7BFC2E0E9D4CF5009A6919 /* debug_flags.cc in Sources */,
4D7BFC330E9D4CF9009A6919 /* env_vars.cc in Sources */,
+ B5FDC0580EE488E500BEC6E6 /* ipc_channel_posix.cc in Sources */,
4D7BFC380E9D4CFF009A6919 /* ipc_message.cc in Sources */,
4D7BFC580E9D4D0E009A6919 /* jpeg_codec.cc in Sources */,
4D7BFC4B0E9D4D06009A6919 /* json_value_serializer.cc in Sources */,
@@ -2856,6 +2964,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ B5FDBFAB0EE4623000BEC6E6 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B5FDC1E50EE48B1600BEC6E6 /* ipc_fuzzing_tests.cc in Sources */,
+ B5FDBFB80EE4627100BEC6E6 /* ipc_tests.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@@ -2984,6 +3101,41 @@
name = zlib;
targetProxy = 4DDC64560EAE393800FB5EBE /* PBXContainerItemProxy */;
};
+ B5067F5B0EE4936200CC5024 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = icui18n;
+ targetProxy = B5067F5A0EE4936200CC5024 /* PBXContainerItemProxy */;
+ };
+ B5067F5D0EE4936A00CC5024 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = base;
+ targetProxy = B5067F5C0EE4936A00CC5024 /* PBXContainerItemProxy */;
+ };
+ B5067F5F0EE4937A00CC5024 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = libevent;
+ targetProxy = B5067F5E0EE4937A00CC5024 /* PBXContainerItemProxy */;
+ };
+ B5067F610EE4937F00CC5024 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = gtest;
+ targetProxy = B5067F600EE4937F00CC5024 /* PBXContainerItemProxy */;
+ };
+ B5067F630EE4938E00CC5024 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = icudata;
+ targetProxy = B5067F620EE4938E00CC5024 /* PBXContainerItemProxy */;
+ };
+ B5067F650EE4938E00CC5024 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = icuuc;
+ targetProxy = B5067F640EE4938E00CC5024 /* PBXContainerItemProxy */;
+ };
+ B5FDBFB40EE4625B00BEC6E6 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4D7BFC190E9D4CB9009A6919 /* common */;
+ targetProxy = B5FDBFB30EE4625B00BEC6E6 /* PBXContainerItemProxy */;
+ };
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@@ -3131,6 +3283,62 @@
};
name = Release;
};
+ B5FDBFB00EE4623000BEC6E6 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 4D7BF2FD0E9D46E6009A6919 /* executable.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "";
+ HEADER_SEARCH_PATHS = (
+ "$(HEADER_SEARCH_PATHS)",
+ ../testing/gtest/include,
+ );
+ INSTALL_PATH = /usr/local/bin;
+ OTHER_LDFLAGS = (
+ "-framework",
+ Foundation,
+ "-framework",
+ AppKit,
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ipc_tests;
+ };
+ name = Debug;
+ };
+ B5FDBFB10EE4623000BEC6E6 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 4D7BF2FD0E9D46E6009A6919 /* executable.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_MODEL_TUNING = G5;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "";
+ HEADER_SEARCH_PATHS = (
+ "$(HEADER_SEARCH_PATHS)",
+ ../testing/gtest/include,
+ );
+ INSTALL_PATH = /usr/local/bin;
+ OTHER_LDFLAGS = (
+ "-framework",
+ Foundation,
+ "-framework",
+ AppKit,
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ipc_tests;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -3197,6 +3405,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ B5FDBFB20EE4625600BEC6E6 /* Build configuration list for PBXNativeTarget "ipc_tests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ B5FDBFB00EE4623000BEC6E6 /* Debug */,
+ B5FDBFB10EE4623000BEC6E6 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
/* End XCConfigurationList section */
};
rootObject = 4D7BF2E90E9D46A4009A6919 /* Project object */;
diff --git a/chrome/common/ipc_channel.cc b/chrome/common/ipc_channel.cc
index 934ea9b..4ffadc3 100644
--- a/chrome/common/ipc_channel.cc
+++ b/chrome/common/ipc_channel.cc
@@ -362,42 +362,6 @@ bool Channel::ProcessOutgoingMessages(MessageLoopForIO::IOContext* context,
return true;
}
-bool Channel::ProcessPendingMessages(DWORD max_wait_msec) {
- return false;
- // TODO(darin): this code is broken and leads to busy waiting
-#if 0
- DCHECK(max_wait_msec <= 0x7FFFFFFF || max_wait_msec == INFINITE);
-
- HANDLE events[] = {
- input_state_.overlapped.hEvent,
- output_state_.overlapped.hEvent
- };
- // Only deal with output messages if we have a connection on which to send
- const int wait_count = waiting_connect_ ? 1 : 2;
- DCHECK(wait_count <= _countof(events));
-
- if (max_wait_msec) {
- DWORD result = WaitForMultipleObjects(wait_count, events, FALSE,
- max_wait_msec);
- if (result == WAIT_TIMEOUT)
- return true;
- }
-
- bool rv = true;
- for (int i = 0; i < wait_count; ++i) {
- if (WaitForSingleObject(events[i], 0) == WAIT_OBJECT_0) {
- if (i == 0 && processing_incoming_) {
- rv = false;
- DLOG(WARNING) << "Would recurse into ProcessIncomingMessages";
- } else {
- OnObjectSignaled(events[i]);
- }
- }
- }
- return rv;
-#endif
-}
-
void Channel::OnIOCompleted(MessageLoopForIO::IOContext* context,
DWORD bytes_transfered, DWORD error) {
bool ok;
diff --git a/chrome/common/ipc_channel.h b/chrome/common/ipc_channel.h
index b69f962..4709166 100644
--- a/chrome/common/ipc_channel.h
+++ b/chrome/common/ipc_channel.h
@@ -14,8 +14,11 @@ namespace IPC {
//------------------------------------------------------------------------------
-class Channel : public MessageLoopForIO::IOHandler,
- public Message::Sender {
+class Channel : public Message::Sender
+#if defined(OS_WIN)
+ , public MessageLoopForIO::IOHandler
+#endif
+ {
// Security tests need access to the pipe handle.
friend class ChannelTest;
@@ -86,16 +89,8 @@ class Channel : public MessageLoopForIO::IOHandler,
//
virtual bool Send(Message* message);
- // Process any pending incoming and outgoing messages. Wait for at most
- // max_wait_msec for pending messages if there are none. Returns true if
- // there were no pending messages or if pending messages were successfully
- // processed. Returns false if there are pending messages that cannot be
- // processed for some reason (e.g., because ProcessIncomingMessages would be
- // re-entered).
- // TODO(darin): Need a better way of dealing with the recursion problem.
- bool ProcessPendingMessages(DWORD max_wait_msec);
-
private:
+#if defined(OS_WIN)
const std::wstring PipeName(const std::wstring& channel_id) const;
bool CreatePipe(const std::wstring& channel_id, Mode mode);
bool ProcessConnection();
@@ -107,12 +102,14 @@ class Channel : public MessageLoopForIO::IOHandler,
// MessageLoop::IOHandler implementation.
virtual void OnIOCompleted(MessageLoopForIO::IOContext* context,
DWORD bytes_transfered, DWORD error);
+#endif
private:
enum {
BUF_SIZE = 4096
};
+#if defined(OS_WIN)
struct State {
explicit State(Channel* channel);
~State();
@@ -124,6 +121,7 @@ class Channel : public MessageLoopForIO::IOHandler,
State output_state_;
HANDLE pipe_;
+#endif
Listener* listener_;
// Messages to be sent are queued here.
@@ -153,10 +151,10 @@ class Channel : public MessageLoopForIO::IOHandler,
// just the process id (pid). The message has a special routing_id
// (MSG_ROUTING_NONE) and type (HELLO_MESSAGE_TYPE).
enum {
- HELLO_MESSAGE_TYPE = MAXWORD // Maximum value of message type (WORD),
- // to avoid conflicting with normal
- // message types, which are enumeration
- // constants starting from 0.
+ HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16),
+ // to avoid conflicting with normal
+ // message types, which are enumeration
+ // constants starting from 0.
};
};
diff --git a/chrome/common/ipc_channel_posix.cc b/chrome/common/ipc_channel_posix.cc
new file mode 100644
index 0000000..4cfcfe6
--- /dev/null
+++ b/chrome/common/ipc_channel_posix.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2008 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.
+
+#include "chrome/common/ipc_channel.h"
+
+
+namespace IPC {
+
+// TODO(playmobil): implement.
+
+//------------------------------------------------------------------------------
+
+Channel::Channel(const std::wstring& channel_id, Mode mode, Listener* listener)
+ : factory_(this) {
+ NOTREACHED();
+}
+
+void Channel::Close() {
+ NOTREACHED();
+}
+
+bool Channel::Send(Message* message) {
+ NOTREACHED();
+ return false;
+}
+
+bool Channel::Connect() {
+ NOTREACHED();
+ return false;
+}
+} // namespace IPC
diff --git a/chrome/common/ipc_channel_proxy.h b/chrome/common/ipc_channel_proxy.h
index 59c8e47..6b9d777 100644
--- a/chrome/common/ipc_channel_proxy.h
+++ b/chrome/common/ipc_channel_proxy.h
@@ -171,7 +171,7 @@ class ChannelProxy : public Message::Sender {
Channel::Listener* listener_;
// List of filters. This is only accessed on the IPC thread.
- std::vector<scoped_refptr<MessageFilter>> filters_;
+ std::vector<scoped_refptr<MessageFilter> > filters_;
MessageLoop* ipc_message_loop_;
Channel* channel_;
std::wstring channel_id_;
diff --git a/chrome/common/ipc_fuzzing_tests.cc b/chrome/common/ipc_fuzzing_tests.cc
index 4b7563b..9216df9 100644
--- a/chrome/common/ipc_fuzzing_tests.cc
+++ b/chrome/common/ipc_fuzzing_tests.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
@@ -10,6 +9,8 @@
#include "chrome/common/ipc_tests.h"
+#include "base/platform_thread.h"
+#include "base/process_util.h"
#include "chrome/common/ipc_channel.h"
#include "chrome/common/ipc_channel_proxy.h"
#include "chrome/common/ipc_message_utils.h"
@@ -209,7 +210,7 @@ class FuzzerServerListener : public SimpleListener {
std::wostringstream wos;
wos << L"IPC fuzzer:" << caller << " [" << value << L" " << text << L"]\n";
std::wstring output = wos.str();
- ::OutputDebugStringW(output.c_str());
+ LOG(WARNING) << output.c_str();
};
int message_count_;
@@ -275,9 +276,9 @@ bool RunFuzzServer() {
// This test makes sure that the FuzzerClientListener and FuzzerServerListener
// are working properly by generating two well formed IPC calls.
TEST(IPCFuzzingTest, SanityTest) {
- HANDLE server_process = SpawnChild(FUZZER_SERVER);
+ base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
- ::Sleep(1000);
+ PlatformThread::Sleep(1000);
FuzzerClientListener listener;
IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT,
&listener);
@@ -294,7 +295,7 @@ TEST(IPCFuzzingTest, SanityTest) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(value, MsgClassSI::ID));
- ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
}
// This test uses a payload that is smaller than expected.
@@ -304,7 +305,7 @@ TEST(IPCFuzzingTest, SanityTest) {
// properly.
#ifdef NDEBUG
TEST(IPCFuzzingTest, MsgBadPayloadShort) {
- HANDLE server_process = SpawnChild(FUZZER_SERVER);
+ base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
::Sleep(1000);
FuzzerClientListener listener;
@@ -333,9 +334,9 @@ TEST(IPCFuzzingTest, MsgBadPayloadShort) {
// This test does not pinpoint a flaw (per se) as by design we don't carry
// type information on the IPC message.
TEST(IPCFuzzingTest, MsgBadPayloadArgs) {
- HANDLE server_process = SpawnChild(FUZZER_SERVER);
+ base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
- ::Sleep(1000);
+ PlatformThread::Sleep(1000);
FuzzerClientListener listener;
IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT,
&listener);
@@ -355,7 +356,7 @@ TEST(IPCFuzzingTest, MsgBadPayloadArgs) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID));
- ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
}
// This class is for testing the IPC_BEGIN_MESSAGE_MAP_EX macros.
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 4fd66e1..af61c85 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -255,6 +255,7 @@ struct ParamTraits<base::Time> {
}
};
+#if defined(OS_WIN)
template <>
struct ParamTraits<LOGFONT> {
typedef LOGFONT param_type;
@@ -299,6 +300,7 @@ struct ParamTraits<MSG> {
return result;
}
};
+#endif // defined(OS_WIN)
template <>
struct ParamTraits<SkBitmap> {
@@ -423,7 +425,7 @@ struct ParamTraits<std::map<K, V> > {
typedef std::map<K, V> param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, static_cast<int>(p.size()));
- param_type::const_iterator iter;
+ typename param_type::const_iterator iter;
for (iter = p.begin(); iter != p.end(); ++iter) {
WriteParam(m, iter->first);
WriteParam(m, iter->second);
@@ -471,6 +473,7 @@ struct ParamTraits<GURL> {
};
// and, a few more useful types...
+#if defined(OS_WIN)
template <>
struct ParamTraits<HANDLE> {
typedef HANDLE param_type;
@@ -580,6 +583,7 @@ struct ParamTraits<POINT> {
l->append(StringPrintf(L"(%d, %d)", p.x, p.y));
}
};
+#endif // defined(OS_WIN)
template <>
struct ParamTraits<gfx::Point> {
@@ -723,6 +727,7 @@ struct ParamTraits<CacheManager::ResourceTypeStats> {
}
};
+#if defined(OS_WIN)
template <>
struct ParamTraits<XFORM> {
typedef XFORM param_type;
@@ -746,6 +751,7 @@ struct ParamTraits<XFORM> {
l->append(L"<XFORM>");
}
};
+#endif // defined(OS_WIN)
template <>
struct ParamTraits<WebCursor> {
@@ -975,7 +981,7 @@ struct ParamTraits<webkit_glue::WebApplicationInfo> {
template <class Param>
class MessageWithTuple : public Message {
public:
- MessageWithTuple(int32 routing_id, WORD type, const Param& p)
+ MessageWithTuple(int32 routing_id, uint16 type, const Param& p)
: Message(routing_id, type, PRIORITY_NORMAL) {
WriteParam(this, p);
}
@@ -1086,7 +1092,7 @@ void GenerateLogData(const std::wstring& channel, const Message& message,
template <class SendParam, class ReplyParam>
class MessageWithReply : public SyncMessage {
public:
- MessageWithReply(int32 routing_id, WORD type,
+ MessageWithReply(int32 routing_id, uint16 type,
const SendParam& send, const ReplyParam& reply)
: SyncMessage(routing_id, type, PRIORITY_NORMAL,
new ParamDeserializer<ReplyParam>(reply)) {
@@ -1108,7 +1114,7 @@ class MessageWithReply : public SyncMessage {
} else {
// This is an outgoing reply. Now that we have the output parameters, we
// can finally log the message.
- ReplyParam::ValueTuple p;
+ typename ReplyParam::ValueTuple p;
void* iter = SyncMessage::GetDataIterator(msg);
ReadParam(msg, &iter, &p);
LogParam(p, l);
@@ -1122,7 +1128,7 @@ class MessageWithReply : public SyncMessage {
Message* reply = GenerateReply(msg);
bool error;
if (ReadParam(msg, &iter, &send_params)) {
- ReplyParam::ValueTuple reply_params;
+ typename ReplyParam::ValueTuple reply_params;
DispatchToMethod(obj, func, send_params, &reply_params);
WriteParam(reply, reply_params);
error = false;
diff --git a/chrome/common/ipc_sync_message.h b/chrome/common/ipc_sync_message.h
index 86cb62f..116e6c7 100644
--- a/chrome/common/ipc_sync_message.h
+++ b/chrome/common/ipc_sync_message.h
@@ -5,7 +5,9 @@
#ifndef CHROME_COMMON_IPC_SYNC_MESSAGE_H__
#define CHROME_COMMON_IPC_SYNC_MESSAGE_H__
+#if defined(OS_WIN)
#include <windows.h>
+#endif
#include <string>
#include "base/basictypes.h"
#include "chrome/common/ipc_message.h"
@@ -16,7 +18,7 @@ class MessageReplyDeserializer;
class SyncMessage : public Message {
public:
- SyncMessage(int32 routing_id, WORD type, PriorityValue priority,
+ SyncMessage(int32 routing_id, uint16 type, PriorityValue priority,
MessageReplyDeserializer* deserializer);
// Call this to get a deserializer for the output parameters.
@@ -24,6 +26,8 @@ class SyncMessage : public Message {
// for deleting the deserializer when they're done.
MessageReplyDeserializer* GetReplyDeserializer();
+// TODO(playmobil): reimplement on POSIX.
+#if defined(OS_WIN)
// If this message can cause the receiver to block while waiting for user
// input (i.e. by calling MessageBox), then the caller needs to pump window
// messages and dispatch asynchronous messages while waiting for the reply.
@@ -44,6 +48,7 @@ class SyncMessage : public Message {
void EnableMessagePumping();
HANDLE pump_messages_event() const { return pump_messages_event_; }
+#endif // defined(OS_WIN)
// Returns true if the message is a reply to the given request id.
static bool IsMessageReplyTo(const Message& msg, int request_id);
@@ -68,7 +73,9 @@ class SyncMessage : public Message {
static bool WriteSyncHeader(Message* msg, const SyncHeader& header);
MessageReplyDeserializer* deserializer_;
+#if defined(OS_WIN)
HANDLE pump_messages_event_;
+#endif
static uint32 next_id_; // for generation of unique ids
};
diff --git a/chrome/common/ipc_tests.cc b/chrome/common/ipc_tests.cc
index 251e970..e0c14c8 100644
--- a/chrome/common/ipc_tests.cc
+++ b/chrome/common/ipc_tests.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#if defined(OS_WIN)
#include <windows.h>
+#endif
#include <stdio.h>
#include <iostream>
#include <string>
@@ -15,6 +17,7 @@
#include "base/debug_on_start.h"
#include "base/perftimer.h"
#include "base/process_util.h"
+#include "base/scoped_nsautorelease_pool.h"
#include "base/thread.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/ipc_channel.h"
@@ -89,7 +92,7 @@ class MyChannelListener : public IPC::Channel::Listener {
virtual void OnMessageReceived(const IPC::Message& message) {
IPC::MessageIterator iter(message);
- int index = iter.NextInt();
+ iter.NextInt();
const std::string data = iter.NextString();
if (--messages_left_ == 0) {
@@ -116,6 +119,8 @@ class MyChannelListener : public IPC::Channel::Listener {
};
static MyChannelListener channel_listener;
+// TODO(playmobil): Implement
+#if defined(OS_WIN)
TEST(IPCChannelTest, ChannelTest) {
// setup IPC channel
IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_SERVER,
@@ -164,6 +169,7 @@ TEST(IPCChannelTest, ChannelProxyTest) {
}
thread.Stop();
}
+#endif // defined(OS_WIN)
static bool RunTestClient() {
// setup IPC channel
@@ -176,7 +182,6 @@ static bool RunTestClient() {
MessageLoop::current()->Run();
return true;
}
-
#endif // !PERFORMANCE_TEST
#ifdef PERFORMANCE_TEST
@@ -340,6 +345,8 @@ static bool RunReflector() {
#endif // PERFORMANCE_TEST
+// TODO(playmobil): Implement
+#if defined(OS_WIN)
// All fatal log messages (e.g. DCHECK failures) imply unit test failures
static void IPCTestAssertHandler(const std::string& str) {
FAIL() << str;
@@ -382,9 +389,21 @@ HANDLE SpawnChild(ChildType child_type) {
return process;
}
+#endif // defined(OS_WIN)
+
+// TODO(playmobil): Implement
+#if defined(OS_POSIX)
+base::ProcessHandle SpawnChild(ChildType child_type) {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+#endif
+
int main(int argc, char** argv) {
+ base::ScopedNSAutoreleasePool scoped_pool;
base::EnableTerminationOnHeapCorruption();
+#if defined(OS_WIN)
// Some tests may use base::Singleton<>, thus we need to instanciate
// the AtExitManager or else we will leak objects.
base::AtExitManager at_exit_manager;
@@ -396,6 +415,7 @@ int main(int argc, char** argv) {
SuppressErrorDialogs();
logging::SetLogAssertHandler(IPCTestAssertHandler);
}
+#endif // defined(OS_WIN)
#ifndef PERFORMANCE_TEST
if (CommandLine().HasSwitch(kChild))
@@ -413,4 +433,3 @@ int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
-
diff --git a/chrome/common/ipc_tests.h b/chrome/common/ipc_tests.h
index e4ef4ce..ceac51a 100644
--- a/chrome/common/ipc_tests.h
+++ b/chrome/common/ipc_tests.h
@@ -5,6 +5,8 @@
#ifndef CHROME_COMMON_IPC_TESTS_H__
#define CHROME_COMMON_IPC_TESTS_H__
+#include "base/process.h"
+
// This unit test uses 3 types of child processes, a regular pipe client,
// a client reflector and a IPC server used for fuzzing tests.
enum ChildType {
@@ -20,7 +22,7 @@ extern const wchar_t kFuzzerChannel[];
// Spawns a child process and then runs the code for one of the 3 possible
// child modes.
-HANDLE SpawnChild(ChildType child_type);
+base::ProcessHandle SpawnChild(ChildType child_type);
// Runs the fuzzing server child mode. Returns true when the preset number
// of messages have been received.