| OLD | NEW |
| 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 "content/browser/blob_storage/blob_dispatcher_host.h" | 5 #include "content/browser/blob_storage/blob_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 !security_policy->CanCommitURL(process_id_, public_url)) { | 295 !security_policy->CanCommitURL(process_id_, public_url)) { |
| 296 bad_message::ReceivedBadMessage(this, bad_message::BDH_DISALLOWED_ORIGIN); | 296 bad_message::ReceivedBadMessage(this, bad_message::BDH_DISALLOWED_ORIGIN); |
| 297 return; | 297 return; |
| 298 } | 298 } |
| 299 if (uuid.empty()) { | 299 if (uuid.empty()) { |
| 300 bad_message::ReceivedBadMessage(this, | 300 bad_message::ReceivedBadMessage(this, |
| 301 bad_message::BDH_INVALID_URL_OPERATION); | 301 bad_message::BDH_INVALID_URL_OPERATION); |
| 302 return; | 302 return; |
| 303 } | 303 } |
| 304 BlobStorageContext* context = this->context(); | 304 BlobStorageContext* context = this->context(); |
| 305 if (!IsInUseInHost(uuid) || context->registry().IsURLMapped(public_url)) { | 305 if (/*!IsInUseInHost(uuid) || */ context->registry().IsURLMapped( |
| 306 public_url)) { |
| 306 UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidURLRegister", BDH_INCREMENT, | 307 UMA_HISTOGRAM_ENUMERATION("Storage.Blob.InvalidURLRegister", BDH_INCREMENT, |
| 307 BDH_TRACING_ENUM_LAST); | 308 BDH_TRACING_ENUM_LAST); |
| 308 return; | 309 return; |
| 309 } | 310 } |
| 310 context->RegisterPublicBlobURL(public_url, uuid); | 311 context->RegisterPublicBlobURL(public_url, uuid); |
| 311 public_blob_urls_.insert(public_url); | 312 public_blob_urls_.insert(public_url); |
| 312 } | 313 } |
| 313 | 314 |
| 314 void BlobDispatcherHost::OnRevokePublicBlobURL(const GURL& public_url) { | 315 void BlobDispatcherHost::OnRevokePublicBlobURL(const GURL& public_url) { |
| 315 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 316 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 BlobStorageContext* context = this->context(); | 367 BlobStorageContext* context = this->context(); |
| 367 for (const auto& url : public_blob_urls_) { | 368 for (const auto& url : public_blob_urls_) { |
| 368 context->RevokePublicBlobURL(url); | 369 context->RevokePublicBlobURL(url); |
| 369 } | 370 } |
| 370 // Keep the blobs alive for the BlobTransportHost call. | 371 // Keep the blobs alive for the BlobTransportHost call. |
| 371 transport_host_.CancelAll(context); | 372 transport_host_.CancelAll(context); |
| 372 blobs_inuse_map_.clear(); | 373 blobs_inuse_map_.clear(); |
| 373 } | 374 } |
| 374 | 375 |
| 375 } // namespace content | 376 } // namespace content |
| OLD | NEW |