| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "extensions/browser/blob_holder.h" | 5 #include "extensions/browser/blob_holder.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <utility> | 8 #include <utility> | 
| 9 | 9 | 
| 10 #include "base/logging.h" | 10 #include "base/logging.h" | 
| 11 #include "content/public/browser/blob_handle.h" | 11 #include "content/public/browser/blob_handle.h" | 
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" | 
| 13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" | 
|  | 14 #include "extensions/browser/bad_message.h" | 
| 14 | 15 | 
| 15 namespace extensions { | 16 namespace extensions { | 
| 16 | 17 | 
| 17 namespace { | 18 namespace { | 
| 18 | 19 | 
| 19 // Address to this variable used as the user data key. | 20 // Address to this variable used as the user data key. | 
| 20 const int kBlobHolderUserDataKey = 0; | 21 const int kBlobHolderUserDataKey = 0; | 
| 21 } | 22 } | 
| 22 | 23 | 
| 23 // static | 24 // static | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 70   for (std::vector<std::string>::const_iterator uuid_it = blob_uuids.begin(); | 71   for (std::vector<std::string>::const_iterator uuid_it = blob_uuids.begin(); | 
| 71        uuid_it != blob_uuids.end(); | 72        uuid_it != blob_uuids.end(); | 
| 72        ++uuid_it) { | 73        ++uuid_it) { | 
| 73     BlobHandleMultimap::iterator it = held_blobs_.find(*uuid_it); | 74     BlobHandleMultimap::iterator it = held_blobs_.find(*uuid_it); | 
| 74 | 75 | 
| 75     if (it != held_blobs_.end()) { | 76     if (it != held_blobs_.end()) { | 
| 76       held_blobs_.erase(it); | 77       held_blobs_.erase(it); | 
| 77     } else { | 78     } else { | 
| 78       DLOG(ERROR) << "Tried to release a Blob we don't have ownership to." | 79       DLOG(ERROR) << "Tried to release a Blob we don't have ownership to." | 
| 79                   << "UUID: " << *uuid_it; | 80                   << "UUID: " << *uuid_it; | 
| 80       render_process_host_->ReceivedBadMessage(); | 81       bad_message::ReceivedBadMessage(render_process_host_, | 
|  | 82                                       bad_message::BH_BLOB_NOT_OWNED); | 
| 81     } | 83     } | 
| 82   } | 84   } | 
| 83 } | 85 } | 
| 84 | 86 | 
| 85 }  // namespace extensions | 87 }  // namespace extensions | 
| OLD | NEW | 
|---|