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

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/DatabaseThread.cpp

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 27 matching lines...) Expand all
38 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 DatabaseThread::DatabaseThread() 42 DatabaseThread::DatabaseThread()
43 : m_transactionClient(adoptPtr(new SQLTransactionClient())) 43 : m_transactionClient(adoptPtr(new SQLTransactionClient()))
44 , m_transactionCoordinator(new SQLTransactionCoordinator()) 44 , m_transactionCoordinator(new SQLTransactionCoordinator())
45 , m_cleanupSync(0) 45 , m_cleanupSync(0)
46 , m_terminationRequested(false) 46 , m_terminationRequested(false)
47 { 47 {
48 m_openDatabaseSet.reserveCapacityForSize(1000);
haraken 2016/01/07 08:06:21 What is this change for?
49 ASSERT(isMainThread());
48 } 50 }
49 51
50 DatabaseThread::~DatabaseThread() 52 DatabaseThread::~DatabaseThread()
51 { 53 {
52 ASSERT(m_openDatabaseSet.isEmpty()); 54 ASSERT(m_openDatabaseSet.isEmpty());
53 ASSERT(!m_thread); 55 ASSERT(!m_thread);
54 } 56 }
55 57
56 DEFINE_TRACE(DatabaseThread) 58 DEFINE_TRACE(DatabaseThread)
57 { 59 {
58 visitor->trace(m_openDatabaseSet); 60 visitor->trace(m_openDatabaseSet);
59 visitor->trace(m_transactionCoordinator); 61 visitor->trace(m_transactionCoordinator);
60 } 62 }
61 63
62 void DatabaseThread::start() 64 void DatabaseThread::start()
63 { 65 {
64 if (m_thread) 66 if (m_thread)
65 return; 67 return;
66 m_thread = WebThreadSupportingGC::create("WebCore: Database"); 68 m_thread = WebThreadSupportingGC::create("WebCore: Database", ThreadState::P erThreadHeapEnabled);
67 m_thread->postTask(BLINK_FROM_HERE, new Task(threadSafeBind(&DatabaseThread: :setupDatabaseThread, this))); 69 m_thread->postTask(BLINK_FROM_HERE, new Task(threadSafeBind(&DatabaseThread: :setupDatabaseThread, this)));
68 } 70 }
69 71
70 void DatabaseThread::setupDatabaseThread() 72 void DatabaseThread::setupDatabaseThread()
71 { 73 {
72 m_thread->initialize(); 74 m_thread->initialize();
73 } 75 }
74 76
75 void DatabaseThread::terminate() 77 void DatabaseThread::terminate()
76 { 78 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 155
154 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task) 156 void DatabaseThread::scheduleTask(PassOwnPtr<DatabaseTask> task)
155 { 157 {
156 ASSERT(m_thread); 158 ASSERT(m_thread);
157 ASSERT(!terminationRequested()); 159 ASSERT(!terminationRequested());
158 // WebThread takes ownership of the task. 160 // WebThread takes ownership of the task.
159 m_thread->postTask(BLINK_FROM_HERE, new Task(threadSafeBind(&DatabaseTask::r un, task))); 161 m_thread->postTask(BLINK_FROM_HERE, new Task(threadSafeBind(&DatabaseTask::r un, task)));
160 } 162 }
161 163
162 } // namespace blink 164 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698