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

Side by Side Diff: base/vlog.cc

Issue 3806005: FBTF: More ctor/dtor cleanup. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Created 10 years, 2 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 | « base/vlog.h ('k') | chrome/browser/appcache/view_appcache_internals_job_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/vlog.h" 5 #include "base/vlog.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 21 matching lines...) Expand all
32 int vlog_level = kDefaultVlogLevel; 32 int vlog_level = kDefaultVlogLevel;
33 if (!base::StringToInt(it->second, &vlog_level)) { 33 if (!base::StringToInt(it->second, &vlog_level)) {
34 LOG(WARNING) << "Parsed vlog level for \"" 34 LOG(WARNING) << "Parsed vlog level for \""
35 << it->first << "=" << it->second 35 << it->first << "=" << it->second
36 << "\" as " << vlog_level; 36 << "\" as " << vlog_level;
37 } 37 }
38 vmodule_levels_.push_back(std::make_pair(it->first, vlog_level)); 38 vmodule_levels_.push_back(std::make_pair(it->first, vlog_level));
39 } 39 }
40 } 40 }
41 41
42 VlogInfo::~VlogInfo() {}
43
42 int VlogInfo::GetVlogLevel(const base::StringPiece& file) { 44 int VlogInfo::GetVlogLevel(const base::StringPiece& file) {
43 if (!vmodule_levels_.empty()) { 45 if (!vmodule_levels_.empty()) {
44 base::StringPiece module(file); 46 base::StringPiece module(file);
45 base::StringPiece::size_type last_slash_pos = 47 base::StringPiece::size_type last_slash_pos =
46 module.find_last_of("\\/"); 48 module.find_last_of("\\/");
47 if (last_slash_pos != base::StringPiece::npos) { 49 if (last_slash_pos != base::StringPiece::npos) {
48 module.remove_prefix(last_slash_pos + 1); 50 module.remove_prefix(last_slash_pos + 1);
49 } 51 }
50 base::StringPiece::size_type extension_start = module.find('.'); 52 base::StringPiece::size_type extension_start = module.find('.');
51 module = module.substr(0, extension_start); 53 module = module.substr(0, extension_start);
52 static const char kInlSuffix[] = "-inl"; 54 static const char kInlSuffix[] = "-inl";
53 static const int kInlSuffixLen = arraysize(kInlSuffix) - 1; 55 static const int kInlSuffixLen = arraysize(kInlSuffix) - 1;
54 if (module.ends_with(kInlSuffix)) { 56 if (module.ends_with(kInlSuffix)) {
55 module.remove_suffix(kInlSuffixLen); 57 module.remove_suffix(kInlSuffixLen);
56 } 58 }
57 for (std::vector<VmodulePattern>::const_iterator it = 59 for (std::vector<VmodulePattern>::const_iterator it =
58 vmodule_levels_.begin(); it != vmodule_levels_.end(); ++it) { 60 vmodule_levels_.begin(); it != vmodule_levels_.end(); ++it) {
59 // TODO(akalin): Use a less-heavyweight version of MatchPattern 61 // TODO(akalin): Use a less-heavyweight version of MatchPattern
60 // (we can pretty much assume we're dealing with ASCII). 62 // (we can pretty much assume we're dealing with ASCII).
61 if (MatchPattern(module, it->first)) { 63 if (MatchPattern(module, it->first)) {
62 return it->second; 64 return it->second;
63 } 65 }
64 } 66 }
65 } 67 }
66 return max_vlog_level_; 68 return max_vlog_level_;
67 } 69 }
68 70
69 } // namespace 71 } // namespace
OLDNEW
« no previous file with comments | « base/vlog.h ('k') | chrome/browser/appcache/view_appcache_internals_job_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698