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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.h

Issue 1925583003: Replace AllowCrossThreadAccess() + non-GCed pointers with crossThreadUnretained() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_4
Patch Set: Rebase. Created 4 years, 5 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef DataConsumerHandleTestUtil_h 5 #ifndef DataConsumerHandleTestUtil_h
6 #define DataConsumerHandleTestUtil_h 6 #define DataConsumerHandleTestUtil_h
7 7
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/testing/NullExecutionContext.h" 9 #include "core/testing/NullExecutionContext.h"
10 #include "gin/public/isolate_holder.h" 10 #include "gin/public/isolate_holder.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // where T is one of HandleReader and HandleTwophaseReader. 492 // where T is one of HandleReader and HandleTwophaseReader.
493 template <typename T> 493 template <typename T>
494 class HandleReaderRunner final { 494 class HandleReaderRunner final {
495 STACK_ALLOCATED(); 495 STACK_ALLOCATED();
496 public: 496 public:
497 explicit HandleReaderRunner(std::unique_ptr<WebDataConsumerHandle> handl e) 497 explicit HandleReaderRunner(std::unique_ptr<WebDataConsumerHandle> handl e)
498 : m_thread(wrapUnique(new Thread("reading thread"))) 498 : m_thread(wrapUnique(new Thread("reading thread")))
499 , m_event(wrapUnique(new WaitableEvent())) 499 , m_event(wrapUnique(new WaitableEvent()))
500 , m_isDone(false) 500 , m_isDone(false)
501 { 501 {
502 m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&Handle ReaderRunner::start, AllowCrossThreadAccess(this), passed(std::move(handle)))); 502 m_thread->thread()->postTask(BLINK_FROM_HERE, threadSafeBind(&Handle ReaderRunner::start, crossThreadUnretained(this), passed(std::move(handle))));
503 } 503 }
504 ~HandleReaderRunner() 504 ~HandleReaderRunner()
505 { 505 {
506 wait(); 506 wait();
507 } 507 }
508 508
509 std::unique_ptr<HandleReadResult> wait() 509 std::unique_ptr<HandleReadResult> wait()
510 { 510 {
511 if (m_isDone) 511 if (m_isDone)
512 return nullptr; 512 return nullptr;
(...skipping 20 matching lines...) Expand all
533 std::unique_ptr<HandleReadResult> m_result; 533 std::unique_ptr<HandleReadResult> m_result;
534 bool m_isDone; 534 bool m_isDone;
535 535
536 std::unique_ptr<T> m_handleReader; 536 std::unique_ptr<T> m_handleReader;
537 }; 537 };
538 }; 538 };
539 539
540 } // namespace blink 540 } // namespace blink
541 541
542 #endif // DataConsumerHandleTestUtil_h 542 #endif // DataConsumerHandleTestUtil_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698