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

Side by Side Diff: Source/core/workers/WorkerMessagingProxy.cpp

Issue 15338009: Move workers to Chromium threading (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert actual model change Created 7 years, 7 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/workers/WorkerContext.cpp ('k') | Source/core/workers/WorkerRunLoop.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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 : m_scriptExecutionContext(workerObject->scriptExecutionContext()) 240 : m_scriptExecutionContext(workerObject->scriptExecutionContext())
241 , m_workerObject(workerObject) 241 , m_workerObject(workerObject)
242 , m_mayBeDestroyed(false) 242 , m_mayBeDestroyed(false)
243 , m_unconfirmedMessageCount(0) 243 , m_unconfirmedMessageCount(0)
244 , m_workerThreadHadPendingActivity(false) 244 , m_workerThreadHadPendingActivity(false)
245 , m_askedToTerminate(false) 245 , m_askedToTerminate(false)
246 , m_pageInspector(0) 246 , m_pageInspector(0)
247 { 247 {
248 ASSERT(m_workerObject); 248 ASSERT(m_workerObject);
249 ASSERT((m_scriptExecutionContext->isDocument() && isMainThread()) 249 ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
250 || (m_scriptExecutionContext->isWorkerContext() && currentThread() == static_cast<WorkerContext*>(m_scriptExecutionContext.get())->thread()->threadID ())); 250 || (m_scriptExecutionContext->isWorkerContext() && static_cast<Worker Context*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
251 } 251 }
252 252
253 WorkerMessagingProxy::~WorkerMessagingProxy() 253 WorkerMessagingProxy::~WorkerMessagingProxy()
254 { 254 {
255 ASSERT(!m_workerObject); 255 ASSERT(!m_workerObject);
256 ASSERT((m_scriptExecutionContext->isDocument() && isMainThread()) 256 ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
257 || (m_scriptExecutionContext->isWorkerContext() && currentThread() == static_cast<WorkerContext*>(m_scriptExecutionContext.get())->thread()->threadID ())); 257 || (m_scriptExecutionContext->isWorkerContext() && static_cast<Worker Context*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()));
258 } 258 }
259 259
260 void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const Strin g& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) 260 void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const Strin g& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
261 { 261 {
262 // FIXME: This need to be revisited when we support nested worker one day 262 // FIXME: This need to be revisited when we support nested worker one day
263 ASSERT(m_scriptExecutionContext->isDocument()); 263 ASSERT(m_scriptExecutionContext->isDocument());
264 Document* document = static_cast<Document*>(m_scriptExecutionContext.get()); 264 Document* document = static_cast<Document*>(m_scriptExecutionContext.get());
265 GroupSettings* settings = 0; 265 GroupSettings* settings = 0;
266 if (document->page()) 266 if (document->page())
267 settings = document->page()->group().groupSettings(); 267 settings = document->page()->group().groupSettings();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 467
468 m_workerThreadHadPendingActivity = hasPendingActivity; 468 m_workerThreadHadPendingActivity = hasPendingActivity;
469 } 469 }
470 470
471 bool WorkerMessagingProxy::hasPendingActivity() const 471 bool WorkerMessagingProxy::hasPendingActivity() const
472 { 472 {
473 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m _askedToTerminate; 473 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m _askedToTerminate;
474 } 474 }
475 475
476 } // namespace WebCore 476 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerContext.cpp ('k') | Source/core/workers/WorkerRunLoop.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698