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

Side by Side Diff: content/child/resource_dispatcher.cc

Issue 689713004: Threaded data provider: Support main thread data notifications (Chrome side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/child/resource_dispatcher.h" 7 #include "content/child/resource_dispatcher.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 RequestPeer* new_peer = 571 RequestPeer* new_peer =
572 delegate_->OnRequestComplete( 572 delegate_->OnRequestComplete(
573 request_info->peer, request_info->resource_type, 573 request_info->peer, request_info->resource_type,
574 request_complete_data.error_code); 574 request_complete_data.error_code);
575 if (new_peer) 575 if (new_peer)
576 request_info->peer = new_peer; 576 request_info->peer = new_peer;
577 } 577 }
578 578
579 base::TimeTicks renderer_completion_time = ToRendererCompletionTime( 579 base::TimeTicks renderer_completion_time = ToRendererCompletionTime(
580 *request_info, request_complete_data.completion_time); 580 *request_info, request_complete_data.completion_time);
581
582 // If we have a threaded data provider, this message needs to bounce off the
583 // background thread before it's returned to this thread and handled,
584 // to make sure it's processed after all incoming data.
585 if (request_info->threaded_data_provider) {
586 request_info->threaded_data_provider->OnRequestCompleteForegroundThread(
587 weak_factory_.GetWeakPtr(), request_complete_data,
588 renderer_completion_time);
589 return;
590 }
591
581 // The request ID will be removed from our pending list in the destructor. 592 // The request ID will be removed from our pending list in the destructor.
582 // Normally, dispatching this message causes the reference-counted request to 593 // Normally, dispatching this message causes the reference-counted request to
583 // die immediately. 594 // die immediately.
584 peer->OnCompletedRequest(request_complete_data.error_code, 595 peer->OnCompletedRequest(request_complete_data.error_code,
585 request_complete_data.was_ignored_by_handler, 596 request_complete_data.was_ignored_by_handler,
586 request_complete_data.exists_in_cache, 597 request_complete_data.exists_in_cache,
587 request_complete_data.security_info, 598 request_complete_data.security_info,
588 renderer_completion_time, 599 renderer_completion_time,
589 request_complete_data.encoded_data_length); 600 request_complete_data.encoded_data_length);
590 } 601 }
591 602
603 void ResourceDispatcher::CompletedRequestAfterBackgroundThreadFlush(
davidben 2015/01/23 19:46:43 Huh. I never failed a separate bug for this, but w
oystein (OOO til 10th of July) 2015/01/23 21:23:47 Interesting! It actually might, though it depends
davidben 2015/01/26 21:53:12 Yeah, I think that stop was triggered by ResourceC
604 int request_id,
605 const ResourceMsg_RequestCompleteData& request_complete_data,
606 const base::TimeTicks& renderer_completion_time) {
607 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
608 if (!request_info)
609 return;
610
611 RequestPeer* peer = request_info->peer;
612 peer->OnCompletedRequest(request_complete_data.error_code,
613 request_complete_data.was_ignored_by_handler,
614 request_complete_data.exists_in_cache,
615 request_complete_data.security_info,
616 renderer_completion_time,
617 request_complete_data.encoded_data_length);
618 }
619
592 int ResourceDispatcher::AddPendingRequest(RequestPeer* callback, 620 int ResourceDispatcher::AddPendingRequest(RequestPeer* callback,
593 ResourceType resource_type, 621 ResourceType resource_type,
594 int origin_pid, 622 int origin_pid,
595 const GURL& frame_origin, 623 const GURL& frame_origin,
596 const GURL& request_url, 624 const GURL& request_url,
597 bool download_to_file) { 625 bool download_to_file) {
598 // Compute a unique request_id for this renderer process. 626 // Compute a unique request_id for this renderer process.
599 int id = MakeRequestID(); 627 int id = MakeRequestID();
600 pending_requests_[id] = PendingRequestInfo(callback, 628 pending_requests_[id] = PendingRequestInfo(callback,
601 resource_type, 629 resource_type,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 924 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
897 while (!queue->empty()) { 925 while (!queue->empty()) {
898 IPC::Message* message = queue->front(); 926 IPC::Message* message = queue->front();
899 ReleaseResourcesInDataMessage(*message); 927 ReleaseResourcesInDataMessage(*message);
900 queue->pop_front(); 928 queue->pop_front();
901 delete message; 929 delete message;
902 } 930 }
903 } 931 }
904 932
905 } // namespace content 933 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698