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

Side by Side Diff: content/public/test/mock_render_process_host.h

Issue 1671933002: Create and pass shared-histogram-allocator from browser to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hsm-merge
Patch Set: cleanup on RenderProcessHostDestroyed instead of RenderProcessExited; use existing ScopedObserver c… Created 4 years, 9 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 (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 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_
6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "base/metrics/persistent_memory_allocator.h"
14 #include "base/observer_list.h" 15 #include "base/observer_list.h"
15 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
16 #include "content/public/browser/render_process_host_factory.h" 17 #include "content/public/browser/render_process_host_factory.h"
17 #include "content/public/common/service_registry.h" 18 #include "content/public/common/service_registry.h"
18 #include "ipc/ipc_test_sink.h" 19 #include "ipc/ipc_test_sink.h"
19 20
20 class StoragePartition; 21 class StoragePartition;
21 22
22 namespace content { 23 namespace content {
23 24
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void SetWebRtcLogMessageCallback( 86 void SetWebRtcLogMessageCallback(
86 base::Callback<void(const std::string&)> callback) override; 87 base::Callback<void(const std::string&)> callback) override;
87 WebRtcStopRtpDumpCallback StartRtpDump( 88 WebRtcStopRtpDumpCallback StartRtpDump(
88 bool incoming, 89 bool incoming,
89 bool outgoing, 90 bool outgoing,
90 const WebRtcRtpPacketCallback& packet_callback) override; 91 const WebRtcRtpPacketCallback& packet_callback) override;
91 #endif 92 #endif
92 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; 93 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override;
93 void NotifyTimezoneChange(const std::string& zone_id) override; 94 void NotifyTimezoneChange(const std::string& zone_id) override;
94 ServiceRegistry* GetServiceRegistry() override; 95 ServiceRegistry* GetServiceRegistry() override;
96 scoped_ptr<base::SharedPersistentMemoryAllocator> GetMetricsAllocator()
97 override;
Alexei Svitkine (slow) 2016/03/24 17:29:53 I think it's pretty strange for the function to be
bcwhite 2016/03/29 11:53:27 Done.
95 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; 98 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override;
96 bool SubscribeUniformEnabled() const override; 99 bool SubscribeUniformEnabled() const override;
97 void OnAddSubscription(unsigned int target) override; 100 void OnAddSubscription(unsigned int target) override;
98 void OnRemoveSubscription(unsigned int target) override; 101 void OnRemoveSubscription(unsigned int target) override;
99 void SendUpdateValueState( 102 void SendUpdateValueState(
100 unsigned int target, const gpu::ValueState& state) override; 103 unsigned int target, const gpu::ValueState& state) override;
101 #if defined(ENABLE_BROWSER_CDMS) 104 #if defined(ENABLE_BROWSER_CDMS)
102 scoped_refptr<media::MediaKeys> GetCdm(int render_frame_id, 105 scoped_refptr<media::MediaKeys> GetCdm(int render_frame_id,
103 int cdm_id) const override; 106 int cdm_id) const override;
104 #endif 107 #endif
(...skipping 28 matching lines...) Expand all
133 136
134 void GetAudioOutputControllers( 137 void GetAudioOutputControllers(
135 const GetAudioOutputControllersCallback& callback) const override {} 138 const GetAudioOutputControllersCallback& callback) const override {}
136 139
137 int worker_ref_count() const { return worker_ref_count_; } 140 int worker_ref_count() const { return worker_ref_count_; }
138 141
139 void SetServiceRegistry(scoped_ptr<ServiceRegistry> service_registry) { 142 void SetServiceRegistry(scoped_ptr<ServiceRegistry> service_registry) {
140 service_registry_ = std::move(service_registry); 143 service_registry_ = std::move(service_registry);
141 } 144 }
142 145
146 void SetMetricsAllocator(
Alexei Svitkine (slow) 2016/03/24 17:29:53 What calls this?
bcwhite 2016/03/29 11:53:27 Nothing. But since it's a mock and allows extract
Alexei Svitkine (slow) 2016/03/29 17:51:24 I don't think we should add it if it's not needed.
bcwhite 2016/03/30 21:25:55 Done.
147 scoped_ptr<base::SharedPersistentMemoryAllocator> allocator) {
148 metrics_allocator_ = std::move(allocator);
149 }
150
143 private: 151 private:
144 // Stores IPC messages that would have been sent to the renderer. 152 // Stores IPC messages that would have been sent to the renderer.
145 IPC::TestSink sink_; 153 IPC::TestSink sink_;
146 int bad_msg_count_; 154 int bad_msg_count_;
147 const MockRenderProcessHostFactory* factory_; 155 const MockRenderProcessHostFactory* factory_;
148 int id_; 156 int id_;
149 bool has_connection_; 157 bool has_connection_;
150 BrowserContext* browser_context_; 158 BrowserContext* browser_context_;
151 base::ObserverList<RenderProcessHostObserver> observers_; 159 base::ObserverList<RenderProcessHostObserver> observers_;
152 160
153 IDMap<RenderWidgetHost> render_widget_hosts_; 161 IDMap<RenderWidgetHost> render_widget_hosts_;
154 int prev_routing_id_; 162 int prev_routing_id_;
155 IDMap<IPC::Listener> listeners_; 163 IDMap<IPC::Listener> listeners_;
156 bool fast_shutdown_started_; 164 bool fast_shutdown_started_;
157 bool deletion_callback_called_; 165 bool deletion_callback_called_;
158 bool is_for_guests_only_; 166 bool is_for_guests_only_;
159 bool is_process_backgrounded_; 167 bool is_process_backgrounded_;
160 scoped_ptr<base::ProcessHandle> process_handle; 168 scoped_ptr<base::ProcessHandle> process_handle;
161 int worker_ref_count_; 169 int worker_ref_count_;
162 scoped_ptr<ServiceRegistry> service_registry_; 170 scoped_ptr<ServiceRegistry> service_registry_;
171 scoped_ptr<base::SharedPersistentMemoryAllocator> metrics_allocator_;
163 172
164 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); 173 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost);
165 }; 174 };
166 175
167 class MockRenderProcessHostFactory : public RenderProcessHostFactory { 176 class MockRenderProcessHostFactory : public RenderProcessHostFactory {
168 public: 177 public:
169 MockRenderProcessHostFactory(); 178 MockRenderProcessHostFactory();
170 ~MockRenderProcessHostFactory() override; 179 ~MockRenderProcessHostFactory() override;
171 180
172 RenderProcessHost* CreateRenderProcessHost( 181 RenderProcessHost* CreateRenderProcessHost(
(...skipping 10 matching lines...) Expand all
183 // for deleting all MockRenderProcessHosts that have not deleted by a test in 192 // for deleting all MockRenderProcessHosts that have not deleted by a test in
184 // the destructor and prevent them from being leaked. 193 // the destructor and prevent them from being leaked.
185 mutable ScopedVector<MockRenderProcessHost> processes_; 194 mutable ScopedVector<MockRenderProcessHost> processes_;
186 195
187 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); 196 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory);
188 }; 197 };
189 198
190 } // namespace content 199 } // namespace content
191 200
192 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ 201 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698