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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "extensions/browser/content_verifier_io_data.h"
6
7 #include "content/public/browser/browser_thread.h"
8
9 namespace extensions {
10
11 ContentVerifierIOData::ExtensionData::ExtensionData(
12 const std::set<base::FilePath>& browser_image_paths,
13 const base::Version& version) {
14 this->browser_image_paths = browser_image_paths;
15 this->version = version;
16 }
17
18 ContentVerifierIOData::ContentVerifierIOData() {
19 }
20
21 ContentVerifierIOData::ExtensionData::~ExtensionData() {
22 }
23
24 ContentVerifierIOData::~ContentVerifierIOData() {
25 }
26
27 void ContentVerifierIOData::AddData(const std::string& extension_id,
28 scoped_ptr<ExtensionData> data) {
29 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
30 data_map_[extension_id] = linked_ptr<ExtensionData>(data.release());
31 }
32
33 void ContentVerifierIOData::RemoveData(const std::string& extension_id) {
34 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
35 std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
36 data_map_.find(extension_id);
37 if (found != data_map_.end())
38 data_map_.erase(found);
39 }
40
41 void ContentVerifierIOData::Clear() {
42 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
43 data_map_.clear();
44 }
45
46 const ContentVerifierIOData::ExtensionData* ContentVerifierIOData::GetData(
47 const std::string& extension_id) {
48 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
49 std::map<std::string, linked_ptr<ExtensionData> >::iterator found =
50 data_map_.find(extension_id);
51 if (found != data_map_.end())
52 return found->second.get();
53 else
54 return NULL;
55 }
56
57 } // namespace extensions
OLDNEW
« 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