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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8DOMActivityLogger.cpp

Issue 2723973002: Make V8Binding helpers return LocalFrame/LocalDOMWindow as appropriate (Closed)
Patch Set: . Created 3 years, 9 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 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 "bindings/core/v8/V8DOMActivityLogger.h" 5 #include "bindings/core/v8/V8DOMActivityLogger.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "platform/weborigin/KURL.h" 8 #include "platform/weborigin/KURL.h"
9 #include "wtf/HashMap.h" 9 #include "wtf/HashMap.h"
10 #include "wtf/text/StringHash.h" 10 #include "wtf/text/StringHash.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return activityLogger(worldId, url.host()); 76 return activityLogger(worldId, url.host());
77 } 77 }
78 78
79 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLogger() { 79 V8DOMActivityLogger* V8DOMActivityLogger::currentActivityLogger() {
80 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 80 v8::Isolate* isolate = v8::Isolate::GetCurrent();
81 if (!isolate->InContext()) 81 if (!isolate->InContext())
82 return 0; 82 return 0;
83 83
84 v8::HandleScope handleScope(isolate); 84 v8::HandleScope handleScope(isolate);
85 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 85 v8::Local<v8::Context> context = isolate->GetCurrentContext();
86 if (context.IsEmpty() || !toDOMWindow(context)) 86 if (context.IsEmpty() || !toLocalDOMWindow(context))
87 return 0; 87 return 0;
88 88
89 V8PerContextData* contextData = ScriptState::from(context)->perContextData(); 89 V8PerContextData* contextData = ScriptState::from(context)->perContextData();
90 if (!contextData) 90 if (!contextData)
91 return 0; 91 return 0;
92 92
93 return contextData->activityLogger(); 93 return contextData->activityLogger();
94 } 94 }
95 95
96 V8DOMActivityLogger* 96 V8DOMActivityLogger*
97 V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld() { 97 V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld() {
98 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 98 v8::Isolate* isolate = v8::Isolate::GetCurrent();
99 if (!isolate->InContext()) 99 if (!isolate->InContext())
100 return 0; 100 return 0;
101 101
102 v8::HandleScope handleScope(isolate); 102 v8::HandleScope handleScope(isolate);
103 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 103 v8::Local<v8::Context> context = isolate->GetCurrentContext();
104 if (context.IsEmpty() || !toDOMWindow(context)) 104 if (context.IsEmpty() || !toLocalDOMWindow(context))
105 return 0; 105 return 0;
106 106
107 ScriptState* scriptState = ScriptState::from(context); 107 ScriptState* scriptState = ScriptState::from(context);
108 if (!scriptState->world().isIsolatedWorld()) 108 if (!scriptState->world().isIsolatedWorld())
109 return 0; 109 return 0;
110 110
111 V8PerContextData* contextData = scriptState->perContextData(); 111 V8PerContextData* contextData = scriptState->perContextData();
112 if (!contextData) 112 if (!contextData)
113 return 0; 113 return 0;
114 114
115 return contextData->activityLogger(); 115 return contextData->activityLogger();
116 } 116 }
117 117
118 } // namespace blink 118 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp ('k') | third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698