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

Unified Diff: extensions/browser/content_verifier_io_data.cc

Issue 407043002: Content Verification: Don't access UI-thread objects on the IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added DCHECK Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/content_verifier_io_data.h ('k') | extensions/browser/content_verify_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/content_verifier_io_data.cc
diff --git a/extensions/browser/content_verifier_io_data.cc b/extensions/browser/content_verifier_io_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e7974887b1883b6aa6e0f6dca3c4415160998d21
--- /dev/null
+++ b/extensions/browser/content_verifier_io_data.cc
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/content_verifier_io_data.h"
+
+#include "content/public/browser/browser_thread.h"
+
+namespace extensions {
+
+ContentVerifierIOData::ExtensionData::ExtensionData(
+ const std::set<base::FilePath>& browser_image_paths,
+ const base::Version& version) {
+ this->browser_image_paths = browser_image_paths;
+ this->version = version;
+}
+
+ContentVerifierIOData::ContentVerifierIOData() {
+}
+
+ContentVerifierIOData::ExtensionData::~ExtensionData() {
+}
+
+ContentVerifierIOData::~ContentVerifierIOData() {
+}
+
+void ContentVerifierIOData::AddData(const std::string& extension_id,
+ scoped_ptr<ExtensionData> data) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ data_map_[extension_id] = linked_ptr<ExtensionData>(data.release());
+}
+
+void ContentVerifierIOData::RemoveData(const std::string& extension_id) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
+ data_map_.find(extension_id);
+ if (found != data_map_.end())
+ data_map_.erase(found);
+}
+
+void ContentVerifierIOData::Clear() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ data_map_.clear();
+}
+
+const ContentVerifierIOData::ExtensionData* ContentVerifierIOData::GetData(
+ const std::string& extension_id) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
+ data_map_.find(extension_id);
+ if (found != data_map_.end())
+ return found->second.get();
+ else
+ return NULL;
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/browser/content_verifier_io_data.h ('k') | extensions/browser/content_verify_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698