OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "bindings/v8/V8DOMActivityLogger.h" | 6 #include "bindings/v8/V8DOMActivityLogger.h" |
7 | 7 |
8 #include "bindings/v8/V8Binding.h" | 8 #include "bindings/v8/V8Binding.h" |
9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" |
10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 return activityLogger(worldId, url.host()); | 69 return activityLogger(worldId, url.host()); |
70 } | 70 } |
71 | 71 |
72 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLogger() | 72 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLogger() |
73 { | 73 { |
74 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 74 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
75 if (!isolate->InContext()) | 75 if (!isolate->InContext()) |
76 return 0; | 76 return 0; |
77 | 77 |
78 V8PerContextData* contextData = ScriptState::current(isolate)->perContextDat
a(); | 78 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
| 79 if (context.IsEmpty() || !toDOMWindow(context)) |
| 80 return 0; |
| 81 |
| 82 V8PerContextData* contextData = ScriptState::from(context)->perContextData()
; |
79 if (!contextData) | 83 if (!contextData) |
80 return 0; | 84 return 0; |
81 | 85 |
82 return contextData->activityLogger(); | 86 return contextData->activityLogger(); |
83 } | 87 } |
84 | 88 |
85 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld() | 89 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld() |
86 { | 90 { |
87 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 91 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
88 if (!isolate->InContext()) | 92 if (!isolate->InContext()) |
89 return 0; | 93 return 0; |
90 | 94 |
91 ScriptState* scriptState = ScriptState::current(isolate); | 95 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
| 96 if (context.IsEmpty() || !toDOMWindow(context)) |
| 97 return 0; |
| 98 |
| 99 ScriptState* scriptState = ScriptState::from(context); |
92 if (!scriptState->world().isIsolatedWorld()) | 100 if (!scriptState->world().isIsolatedWorld()) |
93 return 0; | 101 return 0; |
94 | 102 |
95 V8PerContextData* contextData = scriptState->perContextData(); | 103 V8PerContextData* contextData = scriptState->perContextData(); |
96 if (!contextData) | 104 if (!contextData) |
97 return 0; | 105 return 0; |
98 | 106 |
99 return contextData->activityLogger(); | 107 return contextData->activityLogger(); |
100 } | 108 } |
101 | 109 |
102 } // namespace WebCore | 110 } // namespace WebCore |
OLD | NEW |