summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-02 03:51:25 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-02 03:51:25 +0000
commit78c3e681adfdb9c33a61150f471ba1749e5e7182 (patch)
tree0079888224cebc5e39a62f50c096fa84cc342bac /chrome
parent2f5e746560e7e557d844863bcc40bd09476f5189 (diff)
downloadchromium_src-78c3e681adfdb9c33a61150f471ba1749e5e7182.zip
chromium_src-78c3e681adfdb9c33a61150f471ba1749e5e7182.tar.gz
chromium_src-78c3e681adfdb9c33a61150f471ba1749e5e7182.tar.bz2
We have a bunch of new ui_tests failures. I want
to check if this change (6181) was the cause. I'm reverting. TBR:jeremy Review URL: http://codereview.chromium.org/12856 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6199 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, 71 insertions, 317 deletions
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 5b08bf2..8e9798e 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -140,19 +140,6 @@
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 */; };
@@ -513,55 +500,6 @@
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 */
@@ -1298,8 +1236,6 @@
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>"; };
@@ -1373,23 +1309,6 @@
);
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 */
@@ -1514,7 +1433,6 @@
4D7BFC1A0E9D4CB9009A6919 /* libcommon.a */,
4D640CEB0EAE86BD00EBCFC0 /* librenderer.a */,
4D7BFB2D0E9D4BE5009A6919 /* unit_tests */,
- B5FDBFAE0EE4623000BEC6E6 /* ipc_tests */,
);
name = Products;
sourceTree = "<group>";
@@ -2139,7 +2057,6 @@
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 */,
@@ -2533,29 +2450,6 @@
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 */
@@ -2629,7 +2523,6 @@
4D640CEA0EAE86BD00EBCFC0 /* renderer */,
4D7BFB2C0E9D4BE5009A6919 /* unit_tests */,
4D7B014C0E9D572C009A6919 /* run_unit_tests */,
- B5FDBFAD0EE4623000BEC6E6 /* ipc_tests */,
);
};
/* End PBXProject section */
@@ -2944,7 +2837,6 @@
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 */,
@@ -2964,15 +2856,6 @@
);
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 */
@@ -3101,41 +2984,6 @@
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 */
@@ -3283,62 +3131,6 @@
};
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 */
@@ -3405,15 +3197,6 @@
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 4ffadc3..934ea9b 100644
--- a/chrome/common/ipc_channel.cc
+++ b/chrome/common/ipc_channel.cc
@@ -362,6 +362,42 @@ 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 4709166..b69f962 100644
--- a/chrome/common/ipc_channel.h
+++ b/chrome/common/ipc_channel.h
@@ -14,11 +14,8 @@ namespace IPC {
//------------------------------------------------------------------------------
-class Channel : public Message::Sender
-#if defined(OS_WIN)
- , public MessageLoopForIO::IOHandler
-#endif
- {
+class Channel : public MessageLoopForIO::IOHandler,
+ public Message::Sender {
// Security tests need access to the pipe handle.
friend class ChannelTest;
@@ -89,8 +86,16 @@ class Channel : public Message::Sender
//
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();
@@ -102,14 +107,12 @@ class Channel : public Message::Sender
// 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();
@@ -121,7 +124,6 @@ class Channel : public Message::Sender
State output_state_;
HANDLE pipe_;
-#endif
Listener* listener_;
// Messages to be sent are queued here.
@@ -151,10 +153,10 @@ class Channel : public Message::Sender
// just the process id (pid). The message has a special routing_id
// (MSG_ROUTING_NONE) and type (HELLO_MESSAGE_TYPE).
enum {
- HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16),
- // to avoid conflicting with normal
- // message types, which are enumeration
- // constants starting from 0.
+ HELLO_MESSAGE_TYPE = MAXWORD // Maximum value of message type (WORD),
+ // 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
deleted file mode 100644
index 4cfcfe6..0000000
--- a/chrome/common/ipc_channel_posix.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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 6b9d777..59c8e47 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 9216df9..4b7563b 100644
--- a/chrome/common/ipc_fuzzing_tests.cc
+++ b/chrome/common/ipc_fuzzing_tests.cc
@@ -2,6 +2,7 @@
// 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>
@@ -9,8 +10,6 @@
#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"
@@ -210,7 +209,7 @@ class FuzzerServerListener : public SimpleListener {
std::wostringstream wos;
wos << L"IPC fuzzer:" << caller << " [" << value << L" " << text << L"]\n";
std::wstring output = wos.str();
- LOG(WARNING) << output.c_str();
+ ::OutputDebugStringW(output.c_str());
};
int message_count_;
@@ -276,9 +275,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) {
- base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
+ HANDLE server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
- PlatformThread::Sleep(1000);
+ ::Sleep(1000);
FuzzerClientListener listener;
IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT,
&listener);
@@ -295,7 +294,7 @@ TEST(IPCFuzzingTest, SanityTest) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(value, MsgClassSI::ID));
- EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
+ ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(server_process, 5000));
}
// This test uses a payload that is smaller than expected.
@@ -305,7 +304,7 @@ TEST(IPCFuzzingTest, SanityTest) {
// properly.
#ifdef NDEBUG
TEST(IPCFuzzingTest, MsgBadPayloadShort) {
- base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
+ HANDLE server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
::Sleep(1000);
FuzzerClientListener listener;
@@ -334,9 +333,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) {
- base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
+ HANDLE server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
- PlatformThread::Sleep(1000);
+ ::Sleep(1000);
FuzzerClientListener listener;
IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT,
&listener);
@@ -356,7 +355,7 @@ TEST(IPCFuzzingTest, MsgBadPayloadArgs) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID));
- EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
+ ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(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 af61c85..4fd66e1 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -255,7 +255,6 @@ struct ParamTraits<base::Time> {
}
};
-#if defined(OS_WIN)
template <>
struct ParamTraits<LOGFONT> {
typedef LOGFONT param_type;
@@ -300,7 +299,6 @@ struct ParamTraits<MSG> {
return result;
}
};
-#endif // defined(OS_WIN)
template <>
struct ParamTraits<SkBitmap> {
@@ -425,7 +423,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()));
- typename param_type::const_iterator iter;
+ param_type::const_iterator iter;
for (iter = p.begin(); iter != p.end(); ++iter) {
WriteParam(m, iter->first);
WriteParam(m, iter->second);
@@ -473,7 +471,6 @@ struct ParamTraits<GURL> {
};
// and, a few more useful types...
-#if defined(OS_WIN)
template <>
struct ParamTraits<HANDLE> {
typedef HANDLE param_type;
@@ -583,7 +580,6 @@ struct ParamTraits<POINT> {
l->append(StringPrintf(L"(%d, %d)", p.x, p.y));
}
};
-#endif // defined(OS_WIN)
template <>
struct ParamTraits<gfx::Point> {
@@ -727,7 +723,6 @@ struct ParamTraits<CacheManager::ResourceTypeStats> {
}
};
-#if defined(OS_WIN)
template <>
struct ParamTraits<XFORM> {
typedef XFORM param_type;
@@ -751,7 +746,6 @@ struct ParamTraits<XFORM> {
l->append(L"<XFORM>");
}
};
-#endif // defined(OS_WIN)
template <>
struct ParamTraits<WebCursor> {
@@ -981,7 +975,7 @@ struct ParamTraits<webkit_glue::WebApplicationInfo> {
template <class Param>
class MessageWithTuple : public Message {
public:
- MessageWithTuple(int32 routing_id, uint16 type, const Param& p)
+ MessageWithTuple(int32 routing_id, WORD type, const Param& p)
: Message(routing_id, type, PRIORITY_NORMAL) {
WriteParam(this, p);
}
@@ -1092,7 +1086,7 @@ void GenerateLogData(const std::wstring& channel, const Message& message,
template <class SendParam, class ReplyParam>
class MessageWithReply : public SyncMessage {
public:
- MessageWithReply(int32 routing_id, uint16 type,
+ MessageWithReply(int32 routing_id, WORD type,
const SendParam& send, const ReplyParam& reply)
: SyncMessage(routing_id, type, PRIORITY_NORMAL,
new ParamDeserializer<ReplyParam>(reply)) {
@@ -1114,7 +1108,7 @@ class MessageWithReply : public SyncMessage {
} else {
// This is an outgoing reply. Now that we have the output parameters, we
// can finally log the message.
- typename ReplyParam::ValueTuple p;
+ ReplyParam::ValueTuple p;
void* iter = SyncMessage::GetDataIterator(msg);
ReadParam(msg, &iter, &p);
LogParam(p, l);
@@ -1128,7 +1122,7 @@ class MessageWithReply : public SyncMessage {
Message* reply = GenerateReply(msg);
bool error;
if (ReadParam(msg, &iter, &send_params)) {
- typename ReplyParam::ValueTuple reply_params;
+ 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 116e6c7..86cb62f 100644
--- a/chrome/common/ipc_sync_message.h
+++ b/chrome/common/ipc_sync_message.h
@@ -5,9 +5,7 @@
#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"
@@ -18,7 +16,7 @@ class MessageReplyDeserializer;
class SyncMessage : public Message {
public:
- SyncMessage(int32 routing_id, uint16 type, PriorityValue priority,
+ SyncMessage(int32 routing_id, WORD type, PriorityValue priority,
MessageReplyDeserializer* deserializer);
// Call this to get a deserializer for the output parameters.
@@ -26,8 +24,6 @@ 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.
@@ -48,7 +44,6 @@ 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);
@@ -73,9 +68,7 @@ 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 e0c14c8..251e970 100644
--- a/chrome/common/ipc_tests.cc
+++ b/chrome/common/ipc_tests.cc
@@ -2,9 +2,7 @@
// 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>
@@ -17,7 +15,6 @@
#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"
@@ -92,7 +89,7 @@ class MyChannelListener : public IPC::Channel::Listener {
virtual void OnMessageReceived(const IPC::Message& message) {
IPC::MessageIterator iter(message);
- iter.NextInt();
+ int index = iter.NextInt();
const std::string data = iter.NextString();
if (--messages_left_ == 0) {
@@ -119,8 +116,6 @@ 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,
@@ -169,7 +164,6 @@ TEST(IPCChannelTest, ChannelProxyTest) {
}
thread.Stop();
}
-#endif // defined(OS_WIN)
static bool RunTestClient() {
// setup IPC channel
@@ -182,6 +176,7 @@ static bool RunTestClient() {
MessageLoop::current()->Run();
return true;
}
+
#endif // !PERFORMANCE_TEST
#ifdef PERFORMANCE_TEST
@@ -345,8 +340,6 @@ 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;
@@ -389,21 +382,9 @@ 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;
@@ -415,7 +396,6 @@ int main(int argc, char** argv) {
SuppressErrorDialogs();
logging::SetLogAssertHandler(IPCTestAssertHandler);
}
-#endif // defined(OS_WIN)
#ifndef PERFORMANCE_TEST
if (CommandLine().HasSwitch(kChild))
@@ -433,3 +413,4 @@ 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 ceac51a..e4ef4ce 100644
--- a/chrome/common/ipc_tests.h
+++ b/chrome/common/ipc_tests.h
@@ -5,8 +5,6 @@
#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 {
@@ -22,7 +20,7 @@ extern const wchar_t kFuzzerChannel[];
// Spawns a child process and then runs the code for one of the 3 possible
// child modes.
-base::ProcessHandle SpawnChild(ChildType child_type);
+HANDLE SpawnChild(ChildType child_type);
// Runs the fuzzing server child mode. Returns true when the preset number
// of messages have been received.