Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / frame_host / cross_site_transferring_request.cc
blob6d3ac2c0d08ea2b6c6ae40fa4dc58939e68af07f
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/frame_host/cross_site_transferring_request.h"
7 #include "base/logging.h"
8 #include "content/browser/loader/cross_site_resource_handler.h"
9 #include "content/browser/loader/resource_dispatcher_host_impl.h"
10 #include "content/public/browser/browser_thread.h"
12 namespace content {
14 namespace {
16 void CancelRequestOnIOThread(GlobalRequestID global_request_id) {
17 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
19 ResourceDispatcherHostImpl::Get()->CancelTransferringNavigation(
20 global_request_id);
23 } // namespace
25 CrossSiteTransferringRequest::CrossSiteTransferringRequest(
26 GlobalRequestID global_request_id)
27 : global_request_id_(global_request_id) {
28 DCHECK(global_request_id_ != GlobalRequestID());
31 CrossSiteTransferringRequest::~CrossSiteTransferringRequest() {
32 if (global_request_id_ == GlobalRequestID())
33 return;
34 BrowserThread::PostTask(
35 BrowserThread::IO,
36 FROM_HERE,
37 base::Bind(&CancelRequestOnIOThread, global_request_id_));
40 void CrossSiteTransferringRequest::ReleaseRequest() {
41 DCHECK_NE(-1, global_request_id_.child_id);
42 DCHECK_NE(-1, global_request_id_.request_id);
43 global_request_id_ = GlobalRequestID();
46 } // namespace content