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

Side by Side Diff: third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp

Issue 2702243003: Disallow cross-thread Persistent<> read access. (Closed)
Patch Set: rebased upto r451733 Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/testing/DummyPageHolder.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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/ThreadableLoader.h" 5 #include "core/loader/ThreadableLoader.h"
6 6
7 #include "core/dom/ExecutionContextTask.h" 7 #include "core/dom/ExecutionContextTask.h"
8 #include "core/loader/DocumentThreadableLoader.h" 8 #include "core/loader/DocumentThreadableLoader.h"
9 #include "core/loader/ThreadableLoaderClient.h" 9 #include "core/loader/ThreadableLoaderClient.h"
10 #include "core/loader/WorkerThreadableLoader.h" 10 #include "core/loader/WorkerThreadableLoader.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 std::unique_ptr<WTF::CrossThreadClosure> task) override { 342 std::unique_ptr<WTF::CrossThreadClosure> task) override {
343 DCHECK(m_workerThread); 343 DCHECK(m_workerThread);
344 m_workerThread->postTask(location, std::move(task)); 344 m_workerThread->postTask(location, std::move(task));
345 } 345 }
346 346
347 RefPtr<SecurityOrigin> m_securityOrigin; 347 RefPtr<SecurityOrigin> m_securityOrigin;
348 std::unique_ptr<MockWorkerReportingProxy> m_mockWorkerReportingProxy; 348 std::unique_ptr<MockWorkerReportingProxy> m_mockWorkerReportingProxy;
349 std::unique_ptr<WorkerThreadForTest> m_workerThread; 349 std::unique_ptr<WorkerThreadForTest> m_workerThread;
350 350
351 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; 351 std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
352 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; 352 // Accessed cross-thread when worker thread posts tasks to the parent.
353 CrossThreadPersistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
353 Checkpoint m_checkpoint; 354 Checkpoint m_checkpoint;
354 // |m_loader| must be touched only from the worker thread only. 355 // |m_loader| must be touched only from the worker thread only.
355 CrossThreadPersistent<ThreadableLoader> m_loader; 356 CrossThreadPersistent<ThreadableLoader> m_loader;
356 }; 357 };
357 358
358 class ThreadableLoaderTest 359 class ThreadableLoaderTest
359 : public ::testing::TestWithParam<ThreadableLoaderToTest> { 360 : public ::testing::TestWithParam<ThreadableLoaderToTest> {
360 public: 361 public:
361 ThreadableLoaderTest() { 362 ThreadableLoaderTest() {
362 switch (GetParam()) { 363 switch (GetParam()) {
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 // test is not saying that didFailAccessControlCheck should be dispatched 884 // test is not saying that didFailAccessControlCheck should be dispatched
884 // synchronously, but is saying that even when a response is served 885 // synchronously, but is saying that even when a response is served
885 // synchronously it should not lead to a crash. 886 // synchronously it should not lead to a crash.
886 startLoader(KURL(KURL(), "about:blank")); 887 startLoader(KURL(KURL(), "about:blank"));
887 callCheckpoint(2); 888 callCheckpoint(2);
888 } 889 }
889 890
890 } // namespace 891 } // namespace
891 892
892 } // namespace blink 893 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/testing/DummyPageHolder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698