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

Side by Side Diff: extensions/common/user_script.cc

Issue 2228743002: Rework some UserScriptLoader logic in preparation to removing UserScript copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 4 years, 4 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
« no previous file with comments | « extensions/common/user_script.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/user_script.h" 5 #include "extensions/common/user_script.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 uint32_t num_files = 0; 281 uint32_t num_files = 0;
282 CHECK(iter->ReadUInt32(&num_files)); 282 CHECK(iter->ReadUInt32(&num_files));
283 scripts->clear(); 283 scripts->clear();
284 for (uint32_t i = 0; i < num_files; ++i) { 284 for (uint32_t i = 0; i < num_files; ++i) {
285 File file; 285 File file;
286 file.Unpickle(pickle, iter); 286 file.Unpickle(pickle, iter);
287 scripts->push_back(file); 287 scripts->push_back(file);
288 } 288 }
289 } 289 }
290 290
291 UserScriptIDPair::UserScriptIDPair(int id, const HostID& host_id)
292 : id(id), host_id(host_id) {}
293
294 UserScriptIDPair::UserScriptIDPair(int id) : id(id), host_id(HostID()) {}
295
296 bool operator<(const UserScriptIDPair& a, const UserScriptIDPair& b) {
297 return a.id < b.id;
298 }
299
291 bool operator<(const UserScript& script1, const UserScript& script2) { 300 bool operator<(const UserScript& script1, const UserScript& script2) {
292 // The only kind of script that should be compared is the kind that has its 301 // The only kind of script that should be compared is the kind that has its
293 // IDs initialized to a meaningful value. 302 // IDs initialized to a meaningful value.
294 DCHECK(script1.id() != -1 && script2.id() != -1); 303 DCHECK(script1.id() != -1 && script2.id() != -1);
295 return script1.id() < script2.id(); 304 return script1.id() < script2.id();
296 } 305 }
297 306
298 } // namespace extensions 307 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/user_script.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698