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

Side by Side Diff: Source/core/inspector/AsyncCallTracker.cpp

Issue 1286383007: Use Optional instead of OwnPtr for holding AllowUserAgentScript (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | Source/core/inspector/InspectorDebuggerAgent.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 "core/dom/ExecutionContext.h" 35 #include "core/dom/ExecutionContext.h"
36 #include "core/dom/ExecutionContextTask.h" 36 #include "core/dom/ExecutionContextTask.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "core/events/EventTarget.h" 38 #include "core/events/EventTarget.h"
39 #include "core/inspector/AsyncOperationMap.h" 39 #include "core/inspector/AsyncOperationMap.h"
40 #include "core/inspector/V8DebuggerAgent.h" 40 #include "core/inspector/V8DebuggerAgent.h"
41 #include "core/xmlhttprequest/XMLHttpRequest.h" 41 #include "core/xmlhttprequest/XMLHttpRequest.h"
42 #include "core/xmlhttprequest/XMLHttpRequestUpload.h" 42 #include "core/xmlhttprequest/XMLHttpRequestUpload.h"
43 #include "platform/ScriptForbiddenScope.h" 43 #include "platform/ScriptForbiddenScope.h"
44 #include "wtf/MainThread.h" 44 #include "wtf/MainThread.h"
45 #include "wtf/Optional.h"
45 #include "wtf/text/StringBuilder.h" 46 #include "wtf/text/StringBuilder.h"
46 #include "wtf/text/StringHash.h" 47 #include "wtf/text/StringHash.h"
47 48
48 namespace { 49 namespace {
49 50
50 static const char setTimeoutName[] = "setTimeout"; 51 static const char setTimeoutName[] = "setTimeout";
51 static const char setIntervalName[] = "setInterval"; 52 static const char setIntervalName[] = "setInterval";
52 static const char requestAnimationFrameName[] = "requestAnimationFrame"; 53 static const char requestAnimationFrameName[] = "requestAnimationFrame";
53 static const char xhrSendName[] = "XMLHttpRequest.send"; 54 static const char xhrSendName[] = "XMLHttpRequest.send";
54 static const char enqueueMutationRecordName[] = "Mutation"; 55 static const char enqueueMutationRecordName[] = "Mutation";
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } else { 235 } else {
235 willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId); 236 willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId);
236 } 237 }
237 return true; 238 return true;
238 } 239 }
239 240
240 void AsyncCallTracker::didEnqueueEvent(EventTarget* eventTarget, Event* event) 241 void AsyncCallTracker::didEnqueueEvent(EventTarget* eventTarget, Event* event)
241 { 242 {
242 ASSERT(eventTarget->executionContext()); 243 ASSERT(eventTarget->executionContext());
243 ASSERT(m_debuggerAgent->trackingAsyncCalls()); 244 ASSERT(m_debuggerAgent->trackingAsyncCalls());
244 OwnPtr<ScriptForbiddenScope::AllowUserAgentScript> allowScripting; 245 Optional<ScriptForbiddenScope::AllowUserAgentScript> allowScripting;
245 if (isMainThread()) 246 if (isMainThread())
246 allowScripting = adoptPtr(new ScriptForbiddenScope::AllowUserAgentScript ()); 247 allowScripting.emplace();
247 int operationId = m_debuggerAgent->traceAsyncOperationStarting(event->type() ); 248 int operationId = m_debuggerAgent->traceAsyncOperationStarting(event->type() );
248 ExecutionContextData* data = createContextDataIfNeeded(eventTarget->executio nContext()); 249 ExecutionContextData* data = createContextDataIfNeeded(eventTarget->executio nContext());
249 data->m_eventCallChains.set(event, operationId); 250 data->m_eventCallChains.set(event, operationId);
250 } 251 }
251 252
252 void AsyncCallTracker::didRemoveEvent(EventTarget* eventTarget, Event* event) 253 void AsyncCallTracker::didRemoveEvent(EventTarget* eventTarget, Event* event)
253 { 254 {
254 ASSERT(eventTarget->executionContext()); 255 ASSERT(eventTarget->executionContext());
255 ASSERT(m_debuggerAgent->trackingAsyncCalls()); 256 ASSERT(m_debuggerAgent->trackingAsyncCalls());
256 if (ExecutionContextData* data = m_executionContextDataMap.get(eventTarget-> executionContext())) 257 if (ExecutionContextData* data = m_executionContextDataMap.get(eventTarget-> executionContext()))
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 { 434 {
434 #if ENABLE(OILPAN) 435 #if ENABLE(OILPAN)
435 visitor->trace(m_executionContextDataMap); 436 visitor->trace(m_executionContextDataMap);
436 visitor->trace(m_debuggerAgent); 437 visitor->trace(m_debuggerAgent);
437 visitor->trace(m_instrumentingAgents); 438 visitor->trace(m_instrumentingAgents);
438 #endif 439 #endif
439 V8DebuggerAgent::AsyncCallTrackingListener::trace(visitor); 440 V8DebuggerAgent::AsyncCallTrackingListener::trace(visitor);
440 } 441 }
441 442
442 } // namespace blink 443 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/InspectorDebuggerAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698