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

Side by Side Diff: Source/core/page/NetworkStateNotifier.cpp

Issue 915703002: Add task location information to ExecutionContext (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fileapi/FileReader.cpp ('k') | Source/core/testing/NullExecutionContext.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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 { 71 {
72 ASSERT(isMainThread()); 72 ASSERT(isMainThread());
73 73
74 MutexLocker locker(m_mutex); 74 MutexLocker locker(m_mutex);
75 if (m_type == type) 75 if (m_type == type)
76 return; 76 return;
77 m_type = type; 77 m_type = type;
78 78
79 for (const auto& entry : m_observers) { 79 for (const auto& entry : m_observers) {
80 ExecutionContext* context = entry.key; 80 ExecutionContext* context = entry.key;
81 context->postTask(createCrossThreadTask(&NetworkStateNotifier::notifyObs erversOnContext, this, AllowCrossThreadAccess(context), type)); 81 context->postTask(FROM_HERE, createCrossThreadTask(&NetworkStateNotifier ::notifyObserversOnContext, this, AllowCrossThreadAccess(context), type));
82 } 82 }
83 } 83 }
84 84
85 void NetworkStateNotifier::addObserver(NetworkStateObserver* observer, Execution Context* context) 85 void NetworkStateNotifier::addObserver(NetworkStateObserver* observer, Execution Context* context)
86 { 86 {
87 ASSERT(context->isContextThread()); 87 ASSERT(context->isContextThread());
88 ASSERT(observer); 88 ASSERT(observer);
89 89
90 MutexLocker locker(m_mutex); 90 MutexLocker locker(m_mutex);
91 ObserverListMap::AddResult result = m_observers.add(context, nullptr); 91 ObserverListMap::AddResult result = m_observers.add(context, nullptr);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 list->zeroedObservers.clear(); 173 list->zeroedObservers.clear();
174 174
175 if (list->observers.isEmpty()) { 175 if (list->observers.isEmpty()) {
176 MutexLocker locker(m_mutex); 176 MutexLocker locker(m_mutex);
177 m_observers.remove(context); // deletes list 177 m_observers.remove(context); // deletes list
178 } 178 }
179 } 179 }
180 180
181 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/FileReader.cpp ('k') | Source/core/testing/NullExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698