summaryrefslogtreecommitdiff
path: root/src/debug/di/nativepipeline.cpp
blob: 21105f359a72bded49c5cfe604125edff082e937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//*****************************************************************************
// File: NativePipeline.cpp
// 

//
//*****************************************************************************

#include "stdafx.h"
#include "nativepipeline.h"

#if defined(ENABLE_EVENT_REDIRECTION_PIPELINE)
#include "eventredirection.h"
#include "eventredirectionpipeline.h"
#endif

#include "sstring.h"

//-----------------------------------------------------------------------------
// Returns null if redirection is not enabled, else returns a new redirection pipeline.
INativeEventPipeline * CreateEventRedirectionPipelineIfEnabled()
{
#if !defined(ENABLE_EVENT_REDIRECTION_PIPELINE)
    return NULL;
#else

    BOOL fEnabled = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_DbgRedirect) != 0;
    if (!fEnabled)
    {
        return NULL;
    }

    return new (nothrow) EventRedirectionPipeline();
#endif
}


//-----------------------------------------------------------------------------
// Allocate and return a pipeline object for this platform
// Has debug checks (such as for event redirection)
//
// Returns:
//    newly allocated pipeline object. Caller must call delete on it.
INativeEventPipeline * NewPipelineWithDebugChecks()
{
    CONTRACTL
    {
        NOTHROW;
    }
    CONTRACTL_END;
    INativeEventPipeline * pRedirection = CreateEventRedirectionPipelineIfEnabled();
    if (pRedirection != NULL)
    {
        return pRedirection;
    }

    return NewPipelineForThisPlatform();
}