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

Side by Side Diff: runtime/vm/thread_interrupter_win.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/thread_interrupter_macos.cc ('k') | runtime/vm/thread_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(HOST_OS_WINDOWS) 6 #if defined(HOST_OS_WINDOWS)
7 7
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/profiler.h" 10 #include "vm/profiler.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 state->csp = static_cast<uintptr_t>(context.Rsp); 46 state->csp = static_cast<uintptr_t>(context.Rsp);
47 state->dsp = static_cast<uintptr_t>(context.Rsp); 47 state->dsp = static_cast<uintptr_t>(context.Rsp);
48 #else 48 #else
49 #error Unsupported architecture. 49 #error Unsupported architecture.
50 #endif 50 #endif
51 return true; 51 return true;
52 } 52 }
53 return false; 53 return false;
54 } 54 }
55 55
56
57 static void Interrupt(OSThread* os_thread) { 56 static void Interrupt(OSThread* os_thread) {
58 ASSERT(!OSThread::Compare(GetCurrentThreadId(), os_thread->id())); 57 ASSERT(!OSThread::Compare(GetCurrentThreadId(), os_thread->id()));
59 HANDLE handle = OpenThread( 58 HANDLE handle = OpenThread(
60 THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | THREAD_SUSPEND_RESUME, 59 THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | THREAD_SUSPEND_RESUME,
61 false, os_thread->id()); 60 false, os_thread->id());
62 ASSERT(handle != NULL); 61 ASSERT(handle != NULL);
63 DWORD result = SuspendThread(handle); 62 DWORD result = SuspendThread(handle);
64 if (result == kThreadError) { 63 if (result == kThreadError) {
65 if (FLAG_trace_thread_interrupter) { 64 if (FLAG_trace_thread_interrupter) {
66 OS::PrintErr("ThreadInterrupter failed to suspend thread %p\n", 65 OS::PrintErr("ThreadInterrupter failed to suspend thread %p\n",
(...skipping 18 matching lines...) Expand all
85 // here as the thread which is being queried is suspended. 84 // here as the thread which is being queried is suspended.
86 Thread* thread = os_thread->thread(); 85 Thread* thread = os_thread->thread();
87 if (thread != NULL) { 86 if (thread != NULL) {
88 Profiler::SampleThread(thread, its); 87 Profiler::SampleThread(thread, its);
89 } 88 }
90 ResumeThread(handle); 89 ResumeThread(handle);
91 CloseHandle(handle); 90 CloseHandle(handle);
92 } 91 }
93 }; 92 };
94 93
95
96 bool ThreadInterrupter::IsDebuggerAttached() { 94 bool ThreadInterrupter::IsDebuggerAttached() {
97 return false; 95 return false;
98 } 96 }
99 97
100
101 void ThreadInterrupter::InterruptThread(OSThread* thread) { 98 void ThreadInterrupter::InterruptThread(OSThread* thread) {
102 if (FLAG_trace_thread_interrupter) { 99 if (FLAG_trace_thread_interrupter) {
103 OS::PrintErr("ThreadInterrupter suspending %p\n", 100 OS::PrintErr("ThreadInterrupter suspending %p\n",
104 reinterpret_cast<void*>(thread->id())); 101 reinterpret_cast<void*>(thread->id()));
105 } 102 }
106 ThreadInterrupterWin::Interrupt(thread); 103 ThreadInterrupterWin::Interrupt(thread);
107 if (FLAG_trace_thread_interrupter) { 104 if (FLAG_trace_thread_interrupter) {
108 OS::PrintErr("ThreadInterrupter resuming %p\n", 105 OS::PrintErr("ThreadInterrupter resuming %p\n",
109 reinterpret_cast<void*>(thread->id())); 106 reinterpret_cast<void*>(thread->id()));
110 } 107 }
111 } 108 }
112 109
113
114 void ThreadInterrupter::InstallSignalHandler() { 110 void ThreadInterrupter::InstallSignalHandler() {
115 // Nothing to do on Windows. 111 // Nothing to do on Windows.
116 } 112 }
117 113
118
119 void ThreadInterrupter::RemoveSignalHandler() { 114 void ThreadInterrupter::RemoveSignalHandler() {
120 // Nothing to do on Windows. 115 // Nothing to do on Windows.
121 } 116 }
122 117
123 #endif // !PRODUCT 118 #endif // !PRODUCT
124 119
125 } // namespace dart 120 } // namespace dart
126 121
127 #endif // defined(HOST_OS_WINDOWS) 122 #endif // defined(HOST_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/vm/thread_interrupter_macos.cc ('k') | runtime/vm/thread_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698