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

Side by Side Diff: Source/web/WebDevToolsFrontendImpl.cpp

Issue 23788005: Remove calls to HandleScope default ctor. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: code review (pfeldman) Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebBindings.cpp ('k') | Source/web/WebTestingSupport.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return; 139 return;
140 } 140 }
141 m_inspectorFrontendResumeObserver.clear(); 141 m_inspectorFrontendResumeObserver.clear();
142 doDispatchOnInspectorFrontend(m_messages.takeFirst()); 142 doDispatchOnInspectorFrontend(m_messages.takeFirst());
143 } 143 }
144 } 144 }
145 145
146 void WebDevToolsFrontendImpl::doDispatchOnInspectorFrontend(const WebString& mes sage) 146 void WebDevToolsFrontendImpl::doDispatchOnInspectorFrontend(const WebString& mes sage)
147 { 147 {
148 WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); 148 WebFrameImpl* frame = m_webViewImpl->mainFrameImpl();
149 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 149 if (!frame->frame())
150 v8::HandleScope scope; 150 return;
151 v8::Handle<v8::Context> frameContext = frame->frame() ? frame->frame()->scri pt()->currentWorldContext() : v8::Local<v8::Context>(); 151 v8::Isolate* isolate = frame->frame()->script()->isolate();
152 v8::HandleScope scope(isolate);
153 v8::Handle<v8::Context> frameContext = frame->frame()->script()->currentWorl dContext();
152 v8::Context::Scope contextScope(frameContext); 154 v8::Context::Scope contextScope(frameContext);
153 v8::Handle<v8::Value> inspectorFrontendApiValue = frameContext->Global()->Ge t(v8::String::New("InspectorFrontendAPI")); 155 v8::Handle<v8::Value> inspectorFrontendApiValue = frameContext->Global()->Ge t(v8::String::New("InspectorFrontendAPI"));
154 if (!inspectorFrontendApiValue->IsObject()) 156 if (!inspectorFrontendApiValue->IsObject())
155 return; 157 return;
156 v8::Handle<v8::Object> dispatcherObject = v8::Handle<v8::Object>::Cast(inspe ctorFrontendApiValue); 158 v8::Handle<v8::Object> dispatcherObject = v8::Handle<v8::Object>::Cast(inspe ctorFrontendApiValue);
157 v8::Handle<v8::Value> dispatchFunction = dispatcherObject->Get(v8::String::N ew("dispatchMessage")); 159 v8::Handle<v8::Value> dispatchFunction = dispatcherObject->Get(v8::String::N ew("dispatchMessage"));
158 // The frame might have navigated away from the front-end page (which is sti ll weird), 160 // The frame might have navigated away from the front-end page (which is sti ll weird),
159 // OR the older version of frontend might have a dispatch method in a differ ent place. 161 // OR the older version of frontend might have a dispatch method in a differ ent place.
160 // FIXME(kaznacheev): Remove when Chrome for Android M18 is retired. 162 // FIXME(kaznacheev): Remove when Chrome for Android M18 is retired.
161 if (!dispatchFunction->IsFunction()) { 163 if (!dispatchFunction->IsFunction()) {
162 v8::Handle<v8::Value> inspectorBackendApiValue = frameContext->Global()- >Get(v8::String::New("InspectorBackend")); 164 v8::Handle<v8::Value> inspectorBackendApiValue = frameContext->Global()- >Get(v8::String::New("InspectorBackend"));
163 if (!inspectorBackendApiValue->IsObject()) 165 if (!inspectorBackendApiValue->IsObject())
164 return; 166 return;
165 dispatcherObject = v8::Handle<v8::Object>::Cast(inspectorBackendApiValue ); 167 dispatcherObject = v8::Handle<v8::Object>::Cast(inspectorBackendApiValue );
166 dispatchFunction = dispatcherObject->Get(v8::String::New("dispatch")); 168 dispatchFunction = dispatcherObject->Get(v8::String::New("dispatch"));
167 if (!dispatchFunction->IsFunction()) 169 if (!dispatchFunction->IsFunction())
168 return; 170 return;
169 } 171 }
170 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchF unction); 172 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchF unction);
171 Vector< v8::Handle<v8::Value> > args; 173 Vector< v8::Handle<v8::Value> > args;
172 args.append(v8String(message, isolate)); 174 args.append(v8String(message, isolate));
173 v8::TryCatch tryCatch; 175 v8::TryCatch tryCatch;
174 tryCatch.SetVerbose(true); 176 tryCatch.SetVerbose(true);
175 ScriptController::callFunctionWithInstrumentation(frame->frame() ? frame->fr ame()->document() : 0, function, dispatcherObject, args.size(), args.data()); 177 ScriptController::callFunctionWithInstrumentation(frame->frame() ? frame->fr ame()->document() : 0, function, dispatcherObject, args.size(), args.data());
176 } 178 }
177 179
178 } // namespace WebKit 180 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WebBindings.cpp ('k') | Source/web/WebTestingSupport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698