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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_renderer_state.h

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 // WebViewRendererState manages state data for WebView guest renderer processes. 5 // WebViewRendererState manages state data for WebView guest renderer processes.
6 // 6 //
7 // This class's data can be accessed via its methods from both the UI and IO 7 // This class's data can be accessed via its methods from both the UI and IO
8 // threads, and uses locks to mediate this access. When making changes to this 8 // threads, and uses locks to mediate this access. When making changes to this
9 // class, ensure that you avoid introducing any reentrant code in the methods, 9 // class, ensure that you avoid introducing any reentrant code in the methods,
10 // and that you always aquire the locks in the order |web_view_info_map_lock_| 10 // and that you always aquire the locks in the order |web_view_info_map_lock_|
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 friend class WebViewGuest; 74 friend class WebViewGuest;
75 friend struct base::DefaultSingletonTraits<WebViewRendererState>; 75 friend struct base::DefaultSingletonTraits<WebViewRendererState>;
76 76
77 using RenderId = std::pair<int, int>; 77 using RenderId = std::pair<int, int>;
78 using WebViewInfoMap = std::map<RenderId, WebViewInfo>; 78 using WebViewInfoMap = std::map<RenderId, WebViewInfo>;
79 79
80 struct WebViewPartitionInfo { 80 struct WebViewPartitionInfo {
81 int web_view_count; 81 int web_view_count;
82 std::string partition_id; 82 std::string partition_id;
83 WebViewPartitionInfo() {} 83 WebViewPartitionInfo() {}
84 WebViewPartitionInfo(int count, std::string partition): 84 WebViewPartitionInfo(int count, const std::string& partition)
85 web_view_count(count), 85 : web_view_count(count), partition_id(partition) {}
86 partition_id(partition) {}
87 }; 86 };
88 87
89 using WebViewPartitionIDMap = std::map<int, WebViewPartitionInfo>; 88 using WebViewPartitionIDMap = std::map<int, WebViewPartitionInfo>;
90 89
91 WebViewRendererState(); 90 WebViewRendererState();
92 ~WebViewRendererState(); 91 ~WebViewRendererState();
93 92
94 // Adds/removes a WebView guest render process to/from the set. 93 // Adds/removes a WebView guest render process to/from the set.
95 void AddGuest(int render_process_host_id, int routing_id, 94 void AddGuest(int render_process_host_id, int routing_id,
96 const WebViewInfo& web_view_info); 95 const WebViewInfo& web_view_info);
97 void RemoveGuest(int render_process_host_id, int routing_id); 96 void RemoveGuest(int render_process_host_id, int routing_id);
98 97
99 // Locks are used to mediate access to these maps from both the UI and IO 98 // Locks are used to mediate access to these maps from both the UI and IO
100 // threads. 99 // threads.
101 WebViewInfoMap web_view_info_map_; 100 WebViewInfoMap web_view_info_map_;
102 mutable base::Lock web_view_info_map_lock_; 101 mutable base::Lock web_view_info_map_lock_;
103 WebViewPartitionIDMap web_view_partition_id_map_; 102 WebViewPartitionIDMap web_view_partition_id_map_;
104 mutable base::Lock web_view_partition_id_map_lock_; 103 mutable base::Lock web_view_partition_id_map_lock_;
105 104
106 DISALLOW_COPY_AND_ASSIGN(WebViewRendererState); 105 DISALLOW_COPY_AND_ASSIGN(WebViewRendererState);
107 }; 106 };
108 107
109 } // namespace extensions 108 } // namespace extensions
110 109
111 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ 110 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698