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

Side by Side Diff: src/debug/debug.cc

Issue 2668613002: [inspector] added Debugger.moduleRequested notification
Patch Set: added missing test Created 3 years, 10 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
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 "src/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 void Debug::OnCompileError(Handle<Script> script) { 1887 void Debug::OnCompileError(Handle<Script> script) {
1888 ProcessCompileEvent(v8::CompileError, script); 1888 ProcessCompileEvent(v8::CompileError, script);
1889 } 1889 }
1890 1890
1891 1891
1892 // Handle debugger actions when a new script is compiled. 1892 // Handle debugger actions when a new script is compiled.
1893 void Debug::OnAfterCompile(Handle<Script> script) { 1893 void Debug::OnAfterCompile(Handle<Script> script) {
1894 ProcessCompileEvent(v8::AfterCompile, script); 1894 ProcessCompileEvent(v8::AfterCompile, script);
1895 } 1895 }
1896 1896
1897 void Debug::OnModuleRequested(Handle<Module> referer, Handle<Module> requested,
1898 Handle<String> specifier) {
1899 if (!debug_delegate_) return;
1900 debug_delegate_->ModuleRequested(
1901 ToApiHandle<debug::Script>(handle(referer->script())),
1902 ToApiHandle<debug::Script>(handle(requested->script())),
1903 Utils::ToLocal(specifier));
1904 }
1905
1906 void Debug::ReportRequestedModules() {
1907 if (!debug_delegate_) return;
1908 HandleScope handle_scope(isolate_);
1909 HeapIterator iterator(isolate_->heap());
1910 HeapObject* obj;
1911 while ((obj = iterator.next())) {
1912 if (!obj->IsModule()) continue;
1913 Handle<Module> module(Module::cast(obj));
1914 if (!module->evaluated()) continue;
1915 Handle<FixedArray> requested_modules(module->requested_modules(), isolate_);
1916 Handle<FixedArray> module_requests(module->info()->module_requests(),
1917 isolate_);
1918 for (int j = 0, length = requested_modules->length(); j < length; ++j) {
1919 Handle<Module> import(i::Module::cast(requested_modules->get(j)),
1920 isolate_);
1921 Handle<String> request(i::String::cast(module_requests->get(j)),
1922 isolate_);
1923 OnModuleRequested(module, import, request);
1924 }
1925 }
1926 }
1927
1897 namespace { 1928 namespace {
1898 struct CollectedCallbackData { 1929 struct CollectedCallbackData {
1899 Object** location; 1930 Object** location;
1900 int id; 1931 int id;
1901 Debug* debug; 1932 Debug* debug;
1902 Isolate* isolate; 1933 Isolate* isolate;
1903 1934
1904 CollectedCallbackData(Object** location, int id, Debug* debug, 1935 CollectedCallbackData(Object** location, int id, Debug* debug,
1905 Isolate* isolate) 1936 Isolate* isolate)
1906 : location(location), id(id), debug(debug), isolate(isolate) {} 1937 : location(location), id(id), debug(debug), isolate(isolate) {}
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 return v8::Utils::ToLocal(callback_data_); 2459 return v8::Utils::ToLocal(callback_data_);
2429 } 2460 }
2430 2461
2431 2462
2432 v8::Isolate* EventDetailsImpl::GetIsolate() const { 2463 v8::Isolate* EventDetailsImpl::GetIsolate() const {
2433 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); 2464 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate());
2434 } 2465 }
2435 2466
2436 } // namespace internal 2467 } // namespace internal
2437 } // namespace v8 2468 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698