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

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp

Issue 2608113002: WorkerGlobalScope: verify same-heap event listeners. (Closed)
Patch Set: Created 3 years, 11 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 | no next file » | 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void WorkerGlobalScope::exceptionUnhandled(int exceptionId) { 123 void WorkerGlobalScope::exceptionUnhandled(int exceptionId) {
124 ErrorEvent* event = m_pendingErrorEvents.take(exceptionId); 124 ErrorEvent* event = m_pendingErrorEvents.take(exceptionId);
125 DCHECK(event); 125 DCHECK(event);
126 if (WorkerThreadDebugger* debugger = 126 if (WorkerThreadDebugger* debugger =
127 WorkerThreadDebugger::from(thread()->isolate())) 127 WorkerThreadDebugger::from(thread()->isolate()))
128 debugger->exceptionThrown(m_thread, event); 128 debugger->exceptionThrown(m_thread, event);
129 } 129 }
130 130
131 void WorkerGlobalScope::registerEventListener( 131 void WorkerGlobalScope::registerEventListener(
132 V8AbstractEventListener* eventListener) { 132 V8AbstractEventListener* eventListener) {
133 // TODO(sof): remove once crbug.com/677654 has been diagnosed.
134 CHECK(&ThreadState::fromObject(this)->heap() == &ThreadState::fromObject(event Listener)->heap());
133 bool newEntry = m_eventListeners.add(eventListener).isNewEntry; 135 bool newEntry = m_eventListeners.add(eventListener).isNewEntry;
134 RELEASE_ASSERT(newEntry); 136 CHECK(newEntry);
135 } 137 }
136 138
137 void WorkerGlobalScope::deregisterEventListener( 139 void WorkerGlobalScope::deregisterEventListener(
138 V8AbstractEventListener* eventListener) { 140 V8AbstractEventListener* eventListener) {
139 auto it = m_eventListeners.find(eventListener); 141 auto it = m_eventListeners.find(eventListener);
140 RELEASE_ASSERT(it != m_eventListeners.end()); 142 CHECK(it != m_eventListeners.end());
141 m_eventListeners.remove(it); 143 m_eventListeners.remove(it);
142 } 144 }
143 145
144 WorkerLocation* WorkerGlobalScope::location() const { 146 WorkerLocation* WorkerGlobalScope::location() const {
145 if (!m_location) 147 if (!m_location)
146 m_location = WorkerLocation::create(m_url); 148 m_location = WorkerLocation::create(m_url);
147 return m_location.get(); 149 return m_location.get();
148 } 150 }
149 151
150 WorkerNavigator* WorkerGlobalScope::navigator() const { 152 WorkerNavigator* WorkerGlobalScope::navigator() const {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 visitor->trace(m_timers); 376 visitor->trace(m_timers);
375 visitor->trace(m_eventListeners); 377 visitor->trace(m_eventListeners);
376 visitor->trace(m_pendingErrorEvents); 378 visitor->trace(m_pendingErrorEvents);
377 ExecutionContext::trace(visitor); 379 ExecutionContext::trace(visitor);
378 EventTargetWithInlineData::trace(visitor); 380 EventTargetWithInlineData::trace(visitor);
379 SecurityContext::trace(visitor); 381 SecurityContext::trace(visitor);
380 Supplementable<WorkerGlobalScope>::trace(visitor); 382 Supplementable<WorkerGlobalScope>::trace(visitor);
381 } 383 }
382 384
383 } // namespace blink 385 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698