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