diff options
author | Andrew Au <andrewau@microsoft.com> | 2017-06-16 02:04:41 +0300 |
---|---|---|
committer | Andrew Au <andrewau@microsoft.com> | 2017-06-16 02:04:41 +0300 |
commit | 98c8b4a802146172aa1955467c2fbe6bb3760b69 (patch) | |
tree | 8b66f1403783120093523271ebe4f16adea0ee38 /src/Native/Runtime/DebuggerHook.cpp | |
parent | 34b00937c6c83185d3f3512df2b71d777263f3b4 (diff) |
Refactoring
[tfs-changeset: 1661894]
Diffstat (limited to 'src/Native/Runtime/DebuggerHook.cpp')
-rw-r--r-- | src/Native/Runtime/DebuggerHook.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/Native/Runtime/DebuggerHook.cpp b/src/Native/Runtime/DebuggerHook.cpp index 5c0708c41..87370dbaa 100644 --- a/src/Native/Runtime/DebuggerHook.cpp +++ b/src/Native/Runtime/DebuggerHook.cpp @@ -58,21 +58,27 @@ GVAL_IMPL_INIT(UInt32, g_numGcProtectionRequests, 0); for (uint32_t i = 0; i < g_numGcProtectionRequests; i++) { - if (requests[i].kind == DebuggerGcProtectionRequestKind::EnsureConservativeReporting) - { - EnsureConservativeReporting(requests + i); - } - else if (requests[i].kind == DebuggerGcProtectionRequestKind::RemoveConservativeReporting) - { - RemoveConservativeReporting(requests + i); - } - else if (requests[i].kind == DebuggerGcProtectionRequestKind::EnsureHandle) - { - EnsureHandle(requests + i); - } - else if (requests[i].kind == DebuggerGcProtectionRequestKind::RemoveHandle) + GcProtectionRequest* request = requests + i; + switch(request->kind) { - RemoveHandle(requests + i); + case DebuggerGcProtectionRequestKind::EnsureConservativeReporting: + EnsureConservativeReporting(request); + break; + + case DebuggerGcProtectionRequestKind::RemoveConservativeReporting: + RemoveConservativeReporting(request); + break; + + case DebuggerGcProtectionRequestKind::EnsureHandle: + EnsureHandle(request); + break; + + case DebuggerGcProtectionRequestKind::RemoveHandle: + RemoveHandle(request); + break; + + default: + assert("Debugger is providing an invalid request kind." && false); } } @@ -164,15 +170,7 @@ GVAL_IMPL_INIT(UInt32, g_numGcProtectionRequests, 0); } else { - int handleType; - switch (request->type) - { - case 1: handleType = 2 /* == HNDTYPE_STRONG */; break; - case 2: handleType = 1 /* == HNDTYPE_WEAK_LONG */; break; - default: - assert("Debugger is passing in a wrong handle type" && false); - handleType = 2 /* == HNDTYPE_STRONG */; - } + int handleType = (int)request->type; void* handle = RedhawkGCInterface::CreateTypedHandle((void*)request->address, handleType); s_debuggerOwnedHandles->handle = handle; s_debuggerOwnedHandles->identifier = request->identifier; |