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

Side by Side Diff: content/browser/host_zoom_map_impl.cc

Issue 10377144: Coverity: Fix pass by value errors in HostZoomMap::SetZoomLevel() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | « content/browser/host_zoom_map_impl.h ('k') | content/public/browser/host_zoom_map.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <cmath> 5 #include <cmath>
6 6
7 #include "content/browser/host_zoom_map_impl.h" 7 #include "content/browser/host_zoom_map_impl.h"
8 8
9 #include "base/string_piece.h" 9 #include "base/string_piece.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 host_zoom_levels_[i->first] = i->second; 64 host_zoom_levels_[i->first] = i->second;
65 } 65 }
66 } 66 }
67 67
68 double HostZoomMapImpl::GetZoomLevel(const std::string& host) const { 68 double HostZoomMapImpl::GetZoomLevel(const std::string& host) const {
69 base::AutoLock auto_lock(lock_); 69 base::AutoLock auto_lock(lock_);
70 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); 70 HostZoomLevels::const_iterator i(host_zoom_levels_.find(host));
71 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; 71 return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second;
72 } 72 }
73 73
74 void HostZoomMapImpl::SetZoomLevel(std::string host, double level) { 74 void HostZoomMapImpl::SetZoomLevel(const std::string& host, double level) {
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
76 76
77 { 77 {
78 base::AutoLock auto_lock(lock_); 78 base::AutoLock auto_lock(lock_);
79 79
80 if (content::ZoomValuesEqual(level, default_zoom_level_)) 80 if (content::ZoomValuesEqual(level, default_zoom_level_))
81 host_zoom_levels_.erase(host); 81 host_zoom_levels_.erase(host);
82 else 82 else
83 host_zoom_levels_[host] = level; 83 host_zoom_levels_[host] = level;
84 } 84 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 break; 178 break;
179 } 179 }
180 default: 180 default:
181 NOTREACHED() << "Unexpected preference observed."; 181 NOTREACHED() << "Unexpected preference observed.";
182 } 182 }
183 } 183 }
184 184
185 HostZoomMapImpl::~HostZoomMapImpl() { 185 HostZoomMapImpl::~HostZoomMapImpl() {
186 } 186 }
OLDNEW
« no previous file with comments | « content/browser/host_zoom_map_impl.h ('k') | content/public/browser/host_zoom_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698