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

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

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "wtf/debug/Alias.h" 47 #include "wtf/debug/Alias.h"
48 #include <memory> 48 #include <memory>
49 49
50 namespace blink { 50 namespace blink {
51 51
52 namespace { 52 namespace {
53 53
54 std::unique_ptr<Vector<char>> createVectorFromMemoryRegion( 54 std::unique_ptr<Vector<char>> createVectorFromMemoryRegion(
55 const char* data, 55 const char* data,
56 unsigned dataLength) { 56 unsigned dataLength) {
57 std::unique_ptr<Vector<char>> buffer = makeUnique<Vector<char>>(dataLength); 57 std::unique_ptr<Vector<char>> buffer =
58 WTF::makeUnique<Vector<char>>(dataLength);
58 memcpy(buffer->data(), data, dataLength); 59 memcpy(buffer->data(), data, dataLength);
59 return buffer; 60 return buffer;
60 } 61 }
61 62
62 } // namespace 63 } // namespace
63 64
64 class WorkerThreadableLoader::AsyncTaskForwarder final 65 class WorkerThreadableLoader::AsyncTaskForwarder final
65 : public WorkerThreadableLoader::TaskForwarder { 66 : public WorkerThreadableLoader::TaskForwarder {
66 public: 67 public:
67 explicit AsyncTaskForwarder(PassRefPtr<WorkerLoaderProxy> loaderProxy) 68 explicit AsyncTaskForwarder(PassRefPtr<WorkerLoaderProxy> loaderProxy)
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 std::unique_ptr<WebDataConsumerHandle> handle) { 517 std::unique_ptr<WebDataConsumerHandle> handle) {
517 DCHECK(isMainThread()); 518 DCHECK(isMainThread());
518 CrossThreadPersistent<WorkerThreadableLoader> workerLoader = 519 CrossThreadPersistent<WorkerThreadableLoader> workerLoader =
519 m_workerLoader.get(); 520 m_workerLoader.get();
520 if (!workerLoader || !m_forwarder) 521 if (!workerLoader || !m_forwarder)
521 return; 522 return;
522 m_forwarder->forwardTask( 523 m_forwarder->forwardTask(
523 BLINK_FROM_HERE, 524 BLINK_FROM_HERE,
524 createCrossThreadTask(&WorkerThreadableLoader::didReceiveResponse, 525 createCrossThreadTask(&WorkerThreadableLoader::didReceiveResponse,
525 workerLoader, identifier, response, 526 workerLoader, identifier, response,
526 passed(std::move(handle)))); 527 WTF::passed(std::move(handle))));
527 } 528 }
528 529
529 void WorkerThreadableLoader::MainThreadLoaderHolder::didReceiveData( 530 void WorkerThreadableLoader::MainThreadLoaderHolder::didReceiveData(
530 const char* data, 531 const char* data,
531 unsigned dataLength) { 532 unsigned dataLength) {
532 DCHECK(isMainThread()); 533 DCHECK(isMainThread());
533 CrossThreadPersistent<WorkerThreadableLoader> workerLoader = 534 CrossThreadPersistent<WorkerThreadableLoader> workerLoader =
534 m_workerLoader.get(); 535 m_workerLoader.get();
535 if (!workerLoader || !m_forwarder) 536 if (!workerLoader || !m_forwarder)
536 return; 537 return;
537 m_forwarder->forwardTask( 538 m_forwarder->forwardTask(
538 BLINK_FROM_HERE, 539 BLINK_FROM_HERE,
539 createCrossThreadTask( 540 createCrossThreadTask(
540 &WorkerThreadableLoader::didReceiveData, workerLoader, 541 &WorkerThreadableLoader::didReceiveData, workerLoader,
541 passed(createVectorFromMemoryRegion(data, dataLength)))); 542 WTF::passed(createVectorFromMemoryRegion(data, dataLength))));
542 } 543 }
543 544
544 void WorkerThreadableLoader::MainThreadLoaderHolder::didDownloadData( 545 void WorkerThreadableLoader::MainThreadLoaderHolder::didDownloadData(
545 int dataLength) { 546 int dataLength) {
546 DCHECK(isMainThread()); 547 DCHECK(isMainThread());
547 CrossThreadPersistent<WorkerThreadableLoader> workerLoader = 548 CrossThreadPersistent<WorkerThreadableLoader> workerLoader =
548 m_workerLoader.get(); 549 m_workerLoader.get();
549 if (!workerLoader || !m_forwarder) 550 if (!workerLoader || !m_forwarder)
550 return; 551 return;
551 m_forwarder->forwardTask( 552 m_forwarder->forwardTask(
552 BLINK_FROM_HERE, 553 BLINK_FROM_HERE,
553 createCrossThreadTask(&WorkerThreadableLoader::didDownloadData, 554 createCrossThreadTask(&WorkerThreadableLoader::didDownloadData,
554 workerLoader, dataLength)); 555 workerLoader, dataLength));
555 } 556 }
556 557
557 void WorkerThreadableLoader::MainThreadLoaderHolder::didReceiveCachedMetadata( 558 void WorkerThreadableLoader::MainThreadLoaderHolder::didReceiveCachedMetadata(
558 const char* data, 559 const char* data,
559 int dataLength) { 560 int dataLength) {
560 DCHECK(isMainThread()); 561 DCHECK(isMainThread());
561 CrossThreadPersistent<WorkerThreadableLoader> workerLoader = 562 CrossThreadPersistent<WorkerThreadableLoader> workerLoader =
562 m_workerLoader.get(); 563 m_workerLoader.get();
563 if (!workerLoader || !m_forwarder) 564 if (!workerLoader || !m_forwarder)
564 return; 565 return;
565 m_forwarder->forwardTask( 566 m_forwarder->forwardTask(
566 BLINK_FROM_HERE, 567 BLINK_FROM_HERE,
567 createCrossThreadTask( 568 createCrossThreadTask(
568 &WorkerThreadableLoader::didReceiveCachedMetadata, workerLoader, 569 &WorkerThreadableLoader::didReceiveCachedMetadata, workerLoader,
569 passed(createVectorFromMemoryRegion(data, dataLength)))); 570 WTF::passed(createVectorFromMemoryRegion(data, dataLength))));
570 } 571 }
571 572
572 void WorkerThreadableLoader::MainThreadLoaderHolder::didFinishLoading( 573 void WorkerThreadableLoader::MainThreadLoaderHolder::didFinishLoading(
573 unsigned long identifier, 574 unsigned long identifier,
574 double finishTime) { 575 double finishTime) {
575 DCHECK(isMainThread()); 576 DCHECK(isMainThread());
576 CrossThreadPersistent<WorkerThreadableLoader> workerLoader = 577 CrossThreadPersistent<WorkerThreadableLoader> workerLoader =
577 m_workerLoader.release(); 578 m_workerLoader.release();
578 if (!workerLoader || !m_forwarder) 579 if (!workerLoader || !m_forwarder)
579 return; 580 return;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 const ResourceLoaderOptions& originalResourceLoaderOptions) { 667 const ResourceLoaderOptions& originalResourceLoaderOptions) {
667 DCHECK(isMainThread()); 668 DCHECK(isMainThread());
668 ResourceLoaderOptions resourceLoaderOptions = originalResourceLoaderOptions; 669 ResourceLoaderOptions resourceLoaderOptions = originalResourceLoaderOptions;
669 resourceLoaderOptions.requestInitiatorContext = WorkerContext; 670 resourceLoaderOptions.requestInitiatorContext = WorkerContext;
670 m_mainThreadLoader = DocumentThreadableLoader::create(document, this, options, 671 m_mainThreadLoader = DocumentThreadableLoader::create(document, this, options,
671 resourceLoaderOptions); 672 resourceLoaderOptions);
672 m_mainThreadLoader->start(ResourceRequest(request.get())); 673 m_mainThreadLoader->start(ResourceRequest(request.get()));
673 } 674 }
674 675
675 } // namespace blink 676 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698