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/core/v8/V8DOMActivityLogger.h" | 6 #include "bindings/core/v8/V8DOMActivityLogger.h" |
7 | 7 |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/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 v8::HandleScope handleScope(isolate); |
78 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); | 79 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
79 if (context.IsEmpty() || !toDOMWindow(context)) | 80 if (context.IsEmpty() || !toDOMWindow(context)) |
80 return 0; | 81 return 0; |
81 | 82 |
82 V8PerContextData* contextData = ScriptState::from(context)->perContextData()
; | 83 V8PerContextData* contextData = ScriptState::from(context)->perContextData()
; |
83 if (!contextData) | 84 if (!contextData) |
84 return 0; | 85 return 0; |
85 | 86 |
86 return contextData->activityLogger(); | 87 return contextData->activityLogger(); |
87 } | 88 } |
88 | 89 |
89 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld() | 90 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld() |
90 { | 91 { |
91 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 92 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
92 if (!isolate->InContext()) | 93 if (!isolate->InContext()) |
93 return 0; | 94 return 0; |
94 | 95 |
| 96 v8::HandleScope handleScope(isolate); |
95 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); | 97 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
96 if (context.IsEmpty() || !toDOMWindow(context)) | 98 if (context.IsEmpty() || !toDOMWindow(context)) |
97 return 0; | 99 return 0; |
98 | 100 |
99 ScriptState* scriptState = ScriptState::from(context); | 101 ScriptState* scriptState = ScriptState::from(context); |
100 if (!scriptState->world().isIsolatedWorld()) | 102 if (!scriptState->world().isIsolatedWorld()) |
101 return 0; | 103 return 0; |
102 | 104 |
103 V8PerContextData* contextData = scriptState->perContextData(); | 105 V8PerContextData* contextData = scriptState->perContextData(); |
104 if (!contextData) | 106 if (!contextData) |
105 return 0; | 107 return 0; |
106 | 108 |
107 return contextData->activityLogger(); | 109 return contextData->activityLogger(); |
108 } | 110 } |
109 | 111 |
110 } // namespace blink | 112 } // namespace blink |
OLD | NEW |