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

Side by Side Diff: third_party/WebKit/Source/platform/WaitableEvent.cpp

Issue 2688383003: Remove unnecessary SafePointScope (Closed)
Patch Set: temp Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/WaitableEvent.h" 5 #include "platform/WaitableEvent.h"
6 6
7 #include "base/synchronization/waitable_event.h" 7 #include "base/synchronization/waitable_event.h"
8 #include "platform/heap/SafePoint.h" 8 #include "platform/heap/SafePoint.h"
9 #include "platform/heap/ThreadState.h" 9 #include "platform/heap/ThreadState.h"
10 #include "wtf/Optional.h" 10 #include "wtf/Optional.h"
(...skipping 12 matching lines...) Expand all
23 : base::WaitableEvent::InitialState::NOT_SIGNALED)); 23 : base::WaitableEvent::InitialState::NOT_SIGNALED));
24 } 24 }
25 25
26 WaitableEvent::~WaitableEvent() {} 26 WaitableEvent::~WaitableEvent() {}
27 27
28 void WaitableEvent::reset() { 28 void WaitableEvent::reset() {
29 m_impl->Reset(); 29 m_impl->Reset();
30 } 30 }
31 31
32 void WaitableEvent::wait() { 32 void WaitableEvent::wait() {
33 if (ThreadState::current()) { 33 m_impl->Wait();
34 // We only enter a safe point scope if the thread is attached, ex. never
35 // during shutdown.
36 // TODO(esprehn): Why can't SafePointScope do this for us?
37 SafePointScope scope(BlinkGC::HeapPointersOnStack);
38 m_impl->Wait();
39 } else {
40 m_impl->Wait();
41 }
42 } 34 }
43 35
44 void WaitableEvent::signal() { 36 void WaitableEvent::signal() {
45 m_impl->Signal(); 37 m_impl->Signal();
46 } 38 }
47 39
48 size_t WaitableEvent::waitMultiple(const WTF::Vector<WaitableEvent*>& events) { 40 size_t WaitableEvent::waitMultiple(const WTF::Vector<WaitableEvent*>& events) {
49 std::vector<base::WaitableEvent*> baseEvents; 41 std::vector<base::WaitableEvent*> baseEvents;
50 for (size_t i = 0; i < events.size(); ++i) 42 for (size_t i = 0; i < events.size(); ++i)
51 baseEvents.push_back(events[i]->m_impl.get()); 43 baseEvents.push_back(events[i]->m_impl.get());
52 size_t idx = 44 size_t idx =
53 base::WaitableEvent::WaitMany(baseEvents.data(), baseEvents.size()); 45 base::WaitableEvent::WaitMany(baseEvents.data(), baseEvents.size());
54 DCHECK_LT(idx, events.size()); 46 DCHECK_LT(idx, events.size());
55 return idx; 47 return idx;
56 } 48 }
57 49
58 } // namespace blink 50 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698