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

Side by Side Diff: third_party/WebKit/Source/core/testing/DeathAwareScriptWrappable.h

Issue 2301213003: Add tests for trace wrappers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix StringView problem Created 4 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DeathAwareScriptWrappable_h
6 #define DeathAwareScriptWrappable_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "platform/heap/Heap.h"
10 #include "wtf/text/WTFString.h"
11 #include <signal.h>
12
13 namespace blink {
14
15 class DeathAwareScriptWrappable : public GarbageCollectedFinalized<DeathAwareScr iptWrappable>, public ScriptWrappable {
16 DEFINE_WRAPPERTYPEINFO();
17 static DeathAwareScriptWrappable* s_instance;
18 static bool s_hasDied;
19
20 public:
21 virtual ~DeathAwareScriptWrappable()
22 {
23 if (this == s_instance) {
24 s_hasDied = true;
25 }
26 }
27
28 static DeathAwareScriptWrappable* create()
29 {
30 return new DeathAwareScriptWrappable();
31 }
32
33 static bool hasDied() { return s_hasDied; }
34 static void observeDeathsOf(DeathAwareScriptWrappable* instance)
35 {
haraken 2016/09/02 10:53:15 Shall we add DCHECK(!s_instance) (i.e., we're not
Marcel Hlopko 2016/09/02 12:12:40 Cannot, it's a static variable, and is reused betw
36 s_hasDied = false;
37 s_instance = instance;
38 }
39
40 DEFINE_INLINE_VIRTUAL_TRACE() {}
41 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() {}
42 };
43
44 } // namespace blink
45
46 #endif // DeathAwareScriptWrappable_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698