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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp

Issue 1913283003: [DevTools] Rework idle{Started,Finished} instrumentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1907663005
Patch Set: rebased Created 4 years, 7 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 /* 1 /*
2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-2011 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 24 matching lines...) Expand all
35 #include "platform/v8_inspector/DebuggerScript.h" 35 #include "platform/v8_inspector/DebuggerScript.h"
36 #include "platform/v8_inspector/InspectedContext.h" 36 #include "platform/v8_inspector/InspectedContext.h"
37 #include "platform/v8_inspector/ScriptBreakpoint.h" 37 #include "platform/v8_inspector/ScriptBreakpoint.h"
38 #include "platform/v8_inspector/V8Compat.h" 38 #include "platform/v8_inspector/V8Compat.h"
39 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" 39 #include "platform/v8_inspector/V8DebuggerAgentImpl.h"
40 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 40 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
41 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" 41 #include "platform/v8_inspector/V8RuntimeAgentImpl.h"
42 #include "platform/v8_inspector/V8StackTraceImpl.h" 42 #include "platform/v8_inspector/V8StackTraceImpl.h"
43 #include "platform/v8_inspector/V8StringUtil.h" 43 #include "platform/v8_inspector/V8StringUtil.h"
44 #include "platform/v8_inspector/public/V8DebuggerClient.h" 44 #include "platform/v8_inspector/public/V8DebuggerClient.h"
45 #include <v8-profiler.h>
45 46
46 namespace blink { 47 namespace blink {
47 48
48 namespace { 49 namespace {
49 const char stepIntoV8MethodName[] = "stepIntoStatement"; 50 const char stepIntoV8MethodName[] = "stepIntoStatement";
50 const char stepOutV8MethodName[] = "stepOutOfFunction"; 51 const char stepOutV8MethodName[] = "stepOutOfFunction";
51 volatile int s_lastContextId = 0; 52 volatile int s_lastContextId = 0;
52 53
53 inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) 54 inline v8::Local<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate)
54 { 55 {
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(context)) 803 if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(context))
803 agent->willExecuteScript(scriptId); 804 agent->willExecuteScript(scriptId);
804 } 805 }
805 806
806 void V8DebuggerImpl::didExecuteScript(v8::Local<v8::Context> context) 807 void V8DebuggerImpl::didExecuteScript(v8::Local<v8::Context> context)
807 { 808 {
808 if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(context)) 809 if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(context))
809 agent->didExecuteScript(); 810 agent->didExecuteScript();
810 } 811 }
811 812
813 void V8DebuggerImpl::idleStarted()
814 {
815 m_isolate->GetCpuProfiler()->SetIdle(true);
816 }
817
818 void V8DebuggerImpl::idleFinished()
819 {
820 m_isolate->GetCpuProfiler()->SetIdle(false);
821 }
822
812 PassOwnPtr<V8StackTrace> V8DebuggerImpl::captureStackTrace(size_t maxStackSize) 823 PassOwnPtr<V8StackTrace> V8DebuggerImpl::captureStackTrace(size_t maxStackSize)
813 { 824 {
814 V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(m_isolate->GetCurrentC ontext()); 825 V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(m_isolate->GetCurrentC ontext());
815 return V8StackTraceImpl::capture(agent, maxStackSize); 826 return V8StackTraceImpl::capture(agent, maxStackSize);
816 } 827 }
817 828
818 v8::Local<v8::Context> V8DebuggerImpl::regexContext() 829 v8::Local<v8::Context> V8DebuggerImpl::regexContext()
819 { 830 {
820 if (m_regexContext.IsEmpty()) 831 if (m_regexContext.IsEmpty())
821 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate)); 832 m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate));
(...skipping 28 matching lines...) Expand all
850 return m_templates.get(name)->Get(m_isolate); 861 return m_templates.get(name)->Get(m_isolate);
851 } 862 }
852 863
853 void V8DebuggerImpl::setFunctionTemplate(const String16& name, v8::Local<v8::Fun ctionTemplate> functionTemplate) 864 void V8DebuggerImpl::setFunctionTemplate(const String16& name, v8::Local<v8::Fun ctionTemplate> functionTemplate)
854 { 865 {
855 OwnPtr<v8::Global<v8::FunctionTemplate>> global = adoptPtr(new v8::Global<v8 ::FunctionTemplate>(m_isolate, functionTemplate)); 866 OwnPtr<v8::Global<v8::FunctionTemplate>> global = adoptPtr(new v8::Global<v8 ::FunctionTemplate>(m_isolate, functionTemplate));
856 m_templates.set(name, global.release()); 867 m_templates.set(name, global.release());
857 } 868 }
858 869
859 } // namespace blink 870 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698