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

Unified Diff: extensions/browser/content_verifier_io_data.h

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_delegate.h ('k') | extensions/browser/content_verifier_io_data.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.h
diff --git a/extensions/browser/content_verifier_io_data.h b/extensions/browser/content_verifier_io_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..64596f51a3690442dbd7d7a3f758a5edd684c905
--- /dev/null
+++ b/extensions/browser/content_verifier_io_data.h
@@ -0,0 +1,53 @@
+// 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.
+
+#ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
+#define EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "base/files/file_path.h"
+#include "base/memory/linked_ptr.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/version.h"
+
+namespace extensions {
+
+// A helper class for keeping track of data for the ContentVerifier that should
+// only be accessed on the IO thread.
+class ContentVerifierIOData
+ : public base::RefCountedThreadSafe<ContentVerifierIOData> {
+ public:
+ struct ExtensionData {
+ std::set<base::FilePath> browser_image_paths;
+ base::Version version;
+
+ ExtensionData(const std::set<base::FilePath>& browser_image_paths,
+ const base::Version& version);
+ ~ExtensionData();
+ };
+
+ ContentVerifierIOData();
+
+ void AddData(const std::string& extension_id, scoped_ptr<ExtensionData> data);
+ void RemoveData(const std::string& extension_id);
+ void Clear();
+
+ // This should be called on the IO thread, and the return value should not
+ // be retained or used on other threads.
+ const ExtensionData* GetData(const std::string& extension_id);
+
+ protected:
+ friend class base::RefCountedThreadSafe<ContentVerifierIOData>;
+ virtual ~ContentVerifierIOData();
+
+ std::map<std::string, linked_ptr<ExtensionData> > data_map_;
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
« no previous file with comments | « extensions/browser/content_verifier_delegate.h ('k') | extensions/browser/content_verifier_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698