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

Side by Side Diff: Source/platform/TaskSynchronizer.cpp

Issue 596083005: DatabaseBackend should not post a task to an already terminated database thread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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/platform/TaskSynchronizer.h ('k') | 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) 2007, 2008, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2013 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 * 7 *
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 17 matching lines...) Expand all
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "platform/TaskSynchronizer.h" 30 #include "platform/TaskSynchronizer.h"
31 31
32 #include "heap/ThreadState.h" 32 #include "heap/ThreadState.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 TaskSynchronizer::TaskSynchronizer() 36 TaskSynchronizer::TaskSynchronizer()
37 : m_taskCompleted(false) 37 : m_taskCompleted(false)
38 #if ENABLE(ASSERT)
39 , m_hasCheckedForTermination(false)
40 #endif
41 { 38 {
42 } 39 }
43 40
44 void TaskSynchronizer::waitForTaskCompletion() 41 void TaskSynchronizer::waitForTaskCompletion()
45 { 42 {
46 if (ThreadState::current()) { 43 if (ThreadState::current()) {
47 // Prevent the deadlock between park request by other threads and blocki ng 44 // Prevent the deadlock between park request by other threads and blocki ng
48 // by m_synchronousCondition. 45 // by m_synchronousCondition.
49 ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack); 46 ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack);
50 waitForTaskCompletionInternal(); 47 waitForTaskCompletionInternal();
(...skipping 13 matching lines...) Expand all
64 61
65 void TaskSynchronizer::taskCompleted() 62 void TaskSynchronizer::taskCompleted()
66 { 63 {
67 m_synchronousMutex.lock(); 64 m_synchronousMutex.lock();
68 m_taskCompleted = true; 65 m_taskCompleted = true;
69 m_synchronousCondition.signal(); 66 m_synchronousCondition.signal();
70 m_synchronousMutex.unlock(); 67 m_synchronousMutex.unlock();
71 } 68 }
72 69
73 } // namespace blink 70 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/TaskSynchronizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698