Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: visual_studio/NativeClientVSAddIn/UnitTests/ComMessageFilter.cs

Issue 10908249: Remove windows line ending from repo files (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: fix copyright headers Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/UnitTests/ComMessageFilter.cs
diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/ComMessageFilter.cs b/visual_studio/NativeClientVSAddIn/UnitTests/ComMessageFilter.cs
index ae616c35690cf97e89c66e919ef754c46155b1e6..b90d1d35802602c82d6219ec8969bea4c2750082 100644
--- a/visual_studio/NativeClientVSAddIn/UnitTests/ComMessageFilter.cs
+++ b/visual_studio/NativeClientVSAddIn/UnitTests/ComMessageFilter.cs
@@ -1,161 +1,161 @@
-// Copyright (c) 2012 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.
-
-namespace UnitTests
-{
- using System;
- using System.Runtime.InteropServices;
-
- /// <summary>
- /// Interface for IOleMessageFilter.
- /// </summary>
- [ComImport, Guid("00000016-0000-0000-C000-000000000046"),
- InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
- public interface IOleMessageFilter
- {
- /// <summary>
- /// Handles calls for the thread.
- /// </summary>
- /// <param name="dwCallType">The parameter is not used.</param>
- /// <param name="hTaskCaller">The parameter is not used.</param>
- /// <param name="dwTickCount">The parameter is not used.</param>
- /// <param name="lpInterfaceInfo">The parameter is not used.</param>
- /// <returns>Code indicating message was handled.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage(
- "Microsoft.StyleCop.CSharp.NamingRules",
- "SA1305:FieldNamesMustNotUseHungarianNotation",
- Justification = "Matching variable name to COM interface")]
- [PreserveSig]
- int HandleInComingCall(
- int dwCallType,
- IntPtr hTaskCaller,
- int dwTickCount,
- IntPtr lpInterfaceInfo);
-
- /// <summary>
- /// Automatically retries the failed call.
- /// </summary>
- /// <param name="hTaskCallee">The parameter is not used.</param>
- /// <param name="dwTickCount">The parameter is not used.</param>
- /// <param name="dwRejectType">The parameter is not used.</param>
- /// <returns>Code indicating call should be retried.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage(
- "Microsoft.StyleCop.CSharp.NamingRules",
- "SA1305:FieldNamesMustNotUseHungarianNotation",
- Justification = "Matching variable name to COM interface")]
- [PreserveSig]
- int RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType);
-
- /// <summary>
- /// Handles an incoming message by indicating it should be dispatched always.
- /// </summary>
- /// <param name="hTaskCallee">The parameter is not used.</param>
- /// <param name="dwTickCount">The parameter is not used.</param>
- /// <param name="dwPendingType">The parameter is not used.</param>
- /// <returns>Code indicating message should be dispatched.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage(
- "Microsoft.StyleCop.CSharp.NamingRules",
- "SA1305:FieldNamesMustNotUseHungarianNotation",
- Justification = "Matching variable name to COM interface")]
- [PreserveSig]
- int MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType);
- }
-
- /// <summary>
- /// This class receives messages from the COM calls to Visual Studio
- /// and auto-retries them if they fail because VS is busy.
- /// </summary>
- public class ComMessageFilter : IOleMessageFilter
- {
- /// <summary>
- /// Note this registers the filter only for the current thread.
- /// </summary>
- public static void Register()
- {
- IOleMessageFilter oldFilter = null;
- CoRegisterMessageFilter(new ComMessageFilter(), out oldFilter);
- }
-
- /// <summary>
- /// Note this only closes the filter for the current thread.
- /// </summary>
- public static void Revoke()
- {
- IOleMessageFilter oldFilter = null;
- CoRegisterMessageFilter(null, out oldFilter);
- }
-
- /// <summary>
- /// Handles calls for the thread.
- /// </summary>
- /// <param name="dwCallType">The parameter is not used.</param>
- /// <param name="hTaskCaller">The parameter is not used.</param>
- /// <param name="dwTickCount">The parameter is not used.</param>
- /// <param name="lpInterfaceInfo">The parameter is not used.</param>
- /// <returns>Code indicating message was handled.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage(
- "Microsoft.StyleCop.CSharp.NamingRules",
- "SA1305:FieldNamesMustNotUseHungarianNotation",
- Justification = "Matching variable name to COM interface")]
- int IOleMessageFilter.HandleInComingCall(
- int dwCallType,
- System.IntPtr hTaskCaller,
- int dwTickCount,
- System.IntPtr lpInterfaceInfo)
- {
- return 0; // SERVERCALL_ISHANDLED.
- }
-
- /// <summary>
- /// Automatically retries the failed call.
- /// </summary>
- /// <param name="hTaskCallee">The parameter is not used.</param>
- /// <param name="dwTickCount">The parameter is not used.</param>
- /// <param name="dwRejectType">The parameter is not used.</param>
- /// <returns>Code indicating call should be retried.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage(
- "Microsoft.StyleCop.CSharp.NamingRules",
- "SA1305:FieldNamesMustNotUseHungarianNotation",
- Justification = "Matching variable name to COM interface")]
- int IOleMessageFilter.RetryRejectedCall(
- System.IntPtr hTaskCallee,
- int dwTickCount,
- int dwRejectType)
- {
- // If reject type is SERVERCALL_RETRYLATER.
- if (dwRejectType == 2)
- {
- // Immediate retry.
- return 99;
- }
-
- // Cancel call.
- return -1;
- }
-
- /// <summary>
- /// Handles an incoming message by indicating it should be dispatched always.
- /// </summary>
- /// <param name="hTaskCallee">The parameter is not used.</param>
- /// <param name="dwTickCount">The parameter is not used.</param>
- /// <param name="dwPendingType">The parameter is not used.</param>
- /// <returns>Code indicating message should be dispatched.</returns>
- [System.Diagnostics.CodeAnalysis.SuppressMessage(
- "Microsoft.StyleCop.CSharp.NamingRules",
- "SA1305:FieldNamesMustNotUseHungarianNotation",
- Justification = "Matching variable name to COM interface")]
- int IOleMessageFilter.MessagePending(
- System.IntPtr hTaskCallee,
- int dwTickCount,
- int dwPendingType)
- {
- return 2; // PENDINGMSG_WAITDEFPROCESS.
- }
-
- // Implement the IOleMessageFilter interface.
- [DllImport("Ole32.dll")]
- private static extern int CoRegisterMessageFilter(
- IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);
- }
+// Copyright (c) 2012 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.
+
+namespace UnitTests
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ /// <summary>
+ /// Interface for IOleMessageFilter.
+ /// </summary>
+ [ComImport, Guid("00000016-0000-0000-C000-000000000046"),
+ InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IOleMessageFilter
+ {
+ /// <summary>
+ /// Handles calls for the thread.
+ /// </summary>
+ /// <param name="dwCallType">The parameter is not used.</param>
+ /// <param name="hTaskCaller">The parameter is not used.</param>
+ /// <param name="dwTickCount">The parameter is not used.</param>
+ /// <param name="lpInterfaceInfo">The parameter is not used.</param>
+ /// <returns>Code indicating message was handled.</returns>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "Microsoft.StyleCop.CSharp.NamingRules",
+ "SA1305:FieldNamesMustNotUseHungarianNotation",
+ Justification = "Matching variable name to COM interface")]
+ [PreserveSig]
+ int HandleInComingCall(
+ int dwCallType,
+ IntPtr hTaskCaller,
+ int dwTickCount,
+ IntPtr lpInterfaceInfo);
+
+ /// <summary>
+ /// Automatically retries the failed call.
+ /// </summary>
+ /// <param name="hTaskCallee">The parameter is not used.</param>
+ /// <param name="dwTickCount">The parameter is not used.</param>
+ /// <param name="dwRejectType">The parameter is not used.</param>
+ /// <returns>Code indicating call should be retried.</returns>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "Microsoft.StyleCop.CSharp.NamingRules",
+ "SA1305:FieldNamesMustNotUseHungarianNotation",
+ Justification = "Matching variable name to COM interface")]
+ [PreserveSig]
+ int RetryRejectedCall(IntPtr hTaskCallee, int dwTickCount, int dwRejectType);
+
+ /// <summary>
+ /// Handles an incoming message by indicating it should be dispatched always.
+ /// </summary>
+ /// <param name="hTaskCallee">The parameter is not used.</param>
+ /// <param name="dwTickCount">The parameter is not used.</param>
+ /// <param name="dwPendingType">The parameter is not used.</param>
+ /// <returns>Code indicating message should be dispatched.</returns>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "Microsoft.StyleCop.CSharp.NamingRules",
+ "SA1305:FieldNamesMustNotUseHungarianNotation",
+ Justification = "Matching variable name to COM interface")]
+ [PreserveSig]
+ int MessagePending(IntPtr hTaskCallee, int dwTickCount, int dwPendingType);
+ }
+
+ /// <summary>
+ /// This class receives messages from the COM calls to Visual Studio
+ /// and auto-retries them if they fail because VS is busy.
+ /// </summary>
+ public class ComMessageFilter : IOleMessageFilter
+ {
+ /// <summary>
+ /// Note this registers the filter only for the current thread.
+ /// </summary>
+ public static void Register()
+ {
+ IOleMessageFilter oldFilter = null;
+ CoRegisterMessageFilter(new ComMessageFilter(), out oldFilter);
+ }
+
+ /// <summary>
+ /// Note this only closes the filter for the current thread.
+ /// </summary>
+ public static void Revoke()
+ {
+ IOleMessageFilter oldFilter = null;
+ CoRegisterMessageFilter(null, out oldFilter);
+ }
+
+ /// <summary>
+ /// Handles calls for the thread.
+ /// </summary>
+ /// <param name="dwCallType">The parameter is not used.</param>
+ /// <param name="hTaskCaller">The parameter is not used.</param>
+ /// <param name="dwTickCount">The parameter is not used.</param>
+ /// <param name="lpInterfaceInfo">The parameter is not used.</param>
+ /// <returns>Code indicating message was handled.</returns>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "Microsoft.StyleCop.CSharp.NamingRules",
+ "SA1305:FieldNamesMustNotUseHungarianNotation",
+ Justification = "Matching variable name to COM interface")]
+ int IOleMessageFilter.HandleInComingCall(
+ int dwCallType,
+ System.IntPtr hTaskCaller,
+ int dwTickCount,
+ System.IntPtr lpInterfaceInfo)
+ {
+ return 0; // SERVERCALL_ISHANDLED.
+ }
+
+ /// <summary>
+ /// Automatically retries the failed call.
+ /// </summary>
+ /// <param name="hTaskCallee">The parameter is not used.</param>
+ /// <param name="dwTickCount">The parameter is not used.</param>
+ /// <param name="dwRejectType">The parameter is not used.</param>
+ /// <returns>Code indicating call should be retried.</returns>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "Microsoft.StyleCop.CSharp.NamingRules",
+ "SA1305:FieldNamesMustNotUseHungarianNotation",
+ Justification = "Matching variable name to COM interface")]
+ int IOleMessageFilter.RetryRejectedCall(
+ System.IntPtr hTaskCallee,
+ int dwTickCount,
+ int dwRejectType)
+ {
+ // If reject type is SERVERCALL_RETRYLATER.
+ if (dwRejectType == 2)
+ {
+ // Immediate retry.
+ return 99;
+ }
+
+ // Cancel call.
+ return -1;
+ }
+
+ /// <summary>
+ /// Handles an incoming message by indicating it should be dispatched always.
+ /// </summary>
+ /// <param name="hTaskCallee">The parameter is not used.</param>
+ /// <param name="dwTickCount">The parameter is not used.</param>
+ /// <param name="dwPendingType">The parameter is not used.</param>
+ /// <returns>Code indicating message should be dispatched.</returns>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "Microsoft.StyleCop.CSharp.NamingRules",
+ "SA1305:FieldNamesMustNotUseHungarianNotation",
+ Justification = "Matching variable name to COM interface")]
+ int IOleMessageFilter.MessagePending(
+ System.IntPtr hTaskCallee,
+ int dwTickCount,
+ int dwPendingType)
+ {
+ return 2; // PENDINGMSG_WAITDEFPROCESS.
+ }
+
+ // Implement the IOleMessageFilter interface.
+ [DllImport("Ole32.dll")]
+ private static extern int CoRegisterMessageFilter(
+ IOleMessageFilter newFilter, out IOleMessageFilter oldFilter);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698