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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
6 #define EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
7
8 #include <map>
9 #include <set>
10 #include <string>
11
12 #include "base/files/file_path.h"
13 #include "base/memory/linked_ptr.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/version.h"
17
18 namespace extensions {
19
20 // A helper class for keeping track of data for the ContentVerifier that should
21 // only be accessed on the IO thread.
22 class ContentVerifierIOData
23 : public base::RefCountedThreadSafe<ContentVerifierIOData> {
24 public:
25 struct ExtensionData {
26 std::set<base::FilePath> browser_image_paths;
27 base::Version version;
28
29 ExtensionData(const std::set<base::FilePath>& browser_image_paths,
30 const base::Version& version);
31 ~ExtensionData();
32 };
33
34 ContentVerifierIOData();
35
36 void AddData(const std::string& extension_id, scoped_ptr<ExtensionData> data);
37 void RemoveData(const std::string& extension_id);
38 void Clear();
39
40 // This should be called on the IO thread, and the return value should not
41 // be retained or used on other threads.
42 const ExtensionData* GetData(const std::string& extension_id);
43
44 protected:
45 friend class base::RefCountedThreadSafe<ContentVerifierIOData>;
46 virtual ~ContentVerifierIOData();
47
48 std::map<std::string, linked_ptr<ExtensionData> > data_map_;
49 };
50
51 } // namespace extensions
52
53 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
OLDNEW
« 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