1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//*****************************************************************************
5// File: NativePipeline.cpp
6//
7
8//
9//*****************************************************************************
10
11#include "stdafx.h"
12#include "nativepipeline.h"
13
14#if defined(ENABLE_EVENT_REDIRECTION_PIPELINE)
15#include "eventredirection.h"
16#include "eventredirectionpipeline.h"
17#endif
18
19#include "sstring.h"
20
21//-----------------------------------------------------------------------------
22// Returns null if redirection is not enabled, else returns a new redirection pipeline.
23INativeEventPipeline * CreateEventRedirectionPipelineIfEnabled()
24{
25#if !defined(ENABLE_EVENT_REDIRECTION_PIPELINE)
26 return NULL;
27#else
28
29 BOOL fEnabled = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgRedirect) != 0;
30 if (!fEnabled)
31 {
32 return NULL;
33 }
34
35 return new (nothrow) EventRedirectionPipeline();
36#endif
37}
38
39
40//-----------------------------------------------------------------------------
41// Allocate and return a pipeline object for this platform
42// Has debug checks (such as for event redirection)
43//
44// Returns:
45// newly allocated pipeline object. Caller must call delete on it.
46INativeEventPipeline * NewPipelineWithDebugChecks()
47{
48 CONTRACTL
49 {
50 NOTHROW;
51 }
52 CONTRACTL_END;
53 INativeEventPipeline * pRedirection = CreateEventRedirectionPipelineIfEnabled();
54 if (pRedirection != NULL)
55 {
56 return pRedirection;
57 }
58
59 return NewPipelineForThisPlatform();
60}
61
62
63
64
65