OLD | NEW |
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_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 int GetID() const override; | 128 int GetID() const override; |
129 bool HasConnection() const override; | 129 bool HasConnection() const override; |
130 void SetIgnoreInputEvents(bool ignore_input_events) override; | 130 void SetIgnoreInputEvents(bool ignore_input_events) override; |
131 bool IgnoreInputEvents() const override; | 131 bool IgnoreInputEvents() const override; |
132 void Cleanup() override; | 132 void Cleanup() override; |
133 void AddPendingView() override; | 133 void AddPendingView() override; |
134 void RemovePendingView() override; | 134 void RemovePendingView() override; |
135 void SetSuddenTerminationAllowed(bool enabled) override; | 135 void SetSuddenTerminationAllowed(bool enabled) override; |
136 bool SuddenTerminationAllowed() const override; | 136 bool SuddenTerminationAllowed() const override; |
137 IPC::ChannelProxy* GetChannel() override; | 137 IPC::ChannelProxy* GetChannel() override; |
| 138 IPC::Sender* GetImmediateSender() override; |
| 139 IPC::Sender* GetIOThreadSender() override; |
138 void AddFilter(BrowserMessageFilter* filter) override; | 140 void AddFilter(BrowserMessageFilter* filter) override; |
139 bool FastShutdownForPageCount(size_t count) override; | 141 bool FastShutdownForPageCount(size_t count) override; |
140 bool FastShutdownStarted() const override; | 142 bool FastShutdownStarted() const override; |
141 base::TimeDelta GetChildProcessIdleTime() const override; | 143 base::TimeDelta GetChildProcessIdleTime() const override; |
142 void FilterURL(bool empty_allowed, GURL* url) override; | 144 void FilterURL(bool empty_allowed, GURL* url) override; |
143 #if defined(ENABLE_WEBRTC) | 145 #if defined(ENABLE_WEBRTC) |
144 void EnableAudioDebugRecordings(const base::FilePath& file) override; | 146 void EnableAudioDebugRecordings(const base::FilePath& file) override; |
145 void DisableAudioDebugRecordings() override; | 147 void DisableAudioDebugRecordings() override; |
146 void EnableEventLogRecordings(const base::FilePath& file) override; | 148 void EnableEventLogRecordings(const base::FilePath& file) override; |
147 void DisableEventLogRecordings() override; | 149 void DisableEventLogRecordings() override; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // True if this object has deleted itself. | 286 // True if this object has deleted itself. |
285 bool is_self_deleted_; | 287 bool is_self_deleted_; |
286 #endif | 288 #endif |
287 | 289 |
288 // The count of currently swapped out but pending RenderViews. We have | 290 // The count of currently swapped out but pending RenderViews. We have |
289 // started to swap these in, so the renderer process should not exit if | 291 // started to swap these in, so the renderer process should not exit if |
290 // this count is non-zero. | 292 // this count is non-zero. |
291 int32_t pending_views_; | 293 int32_t pending_views_; |
292 | 294 |
293 private: | 295 private: |
| 296 class SafeSenderProxy; |
| 297 |
| 298 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; |
| 299 friend class SafeSenderProxy; |
294 friend class VisitRelayingRenderProcessHost; | 300 friend class VisitRelayingRenderProcessHost; |
295 friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test; | |
296 | 301 |
297 std::unique_ptr<IPC::ChannelProxy> CreateChannelProxy( | 302 std::unique_ptr<IPC::ChannelProxy> CreateChannelProxy( |
298 const std::string& channel_id); | 303 const std::string& channel_id); |
299 | 304 |
300 // Creates and adds the IO thread message filters. | 305 // Creates and adds the IO thread message filters. |
301 void CreateMessageFilters(); | 306 void CreateMessageFilters(); |
302 | 307 |
| 308 // Shared implementation for IPC::Senders exposed by this RPH. |
| 309 bool SendImpl(std::unique_ptr<IPC::Message> message, bool send_now); |
| 310 |
303 // Registers Mojo services to be exposed to the renderer. | 311 // Registers Mojo services to be exposed to the renderer. |
304 void RegisterMojoServices(); | 312 void RegisterMojoServices(); |
305 | 313 |
306 void CreateStoragePartitionService( | 314 void CreateStoragePartitionService( |
307 mojo::InterfaceRequest<mojom::StoragePartitionService> request); | 315 mojo::InterfaceRequest<mojom::StoragePartitionService> request); |
308 | 316 |
309 // Control message handlers. | 317 // Control message handlers. |
310 void OnShutdownRequest(); | 318 void OnShutdownRequest(); |
311 void SuddenTerminationChanged(bool enabled); | 319 void SuddenTerminationChanged(bool enabled); |
312 void OnUserMetricsRecordAction(const std::string& action); | 320 void OnUserMetricsRecordAction(const std::string& action); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 void SendAecDumpFileToRenderer(int id, | 363 void SendAecDumpFileToRenderer(int id, |
356 IPC::PlatformFileForTransit file_for_transit); | 364 IPC::PlatformFileForTransit file_for_transit); |
357 void SendEventLogFileToRenderer(int id, | 365 void SendEventLogFileToRenderer(int id, |
358 IPC::PlatformFileForTransit file_for_transit); | 366 IPC::PlatformFileForTransit file_for_transit); |
359 void SendDisableAecDumpToRenderer(); | 367 void SendDisableAecDumpToRenderer(); |
360 void SendDisableEventLogToRenderer(); | 368 void SendDisableEventLogToRenderer(); |
361 base::FilePath GetAecDumpFilePathWithExtensions(const base::FilePath& file); | 369 base::FilePath GetAecDumpFilePathWithExtensions(const base::FilePath& file); |
362 base::FilePath GetEventLogFilePathWithExtensions(const base::FilePath& file); | 370 base::FilePath GetEventLogFilePathWithExtensions(const base::FilePath& file); |
363 #endif | 371 #endif |
364 | 372 |
| 373 // IPC::Senders which live as long as this RPH and provide safe, opaque |
| 374 // access to ChannelProxy SendNow() and SendOnIOThread() respectively. |
| 375 const std::unique_ptr<SafeSenderProxy> immediate_sender_; |
| 376 const std::unique_ptr<SafeSenderProxy> io_thread_sender_; |
| 377 |
365 std::unique_ptr<MojoChildConnection> mojo_child_connection_; | 378 std::unique_ptr<MojoChildConnection> mojo_child_connection_; |
366 std::unique_ptr<MojoApplicationHost> mojo_application_host_; | 379 std::unique_ptr<MojoApplicationHost> mojo_application_host_; |
367 | 380 |
368 // The registered IPC listener objects. When this list is empty, we should | 381 // The registered IPC listener objects. When this list is empty, we should |
369 // delete ourselves. | 382 // delete ourselves. |
370 IDMap<IPC::Listener> listeners_; | 383 IDMap<IPC::Listener> listeners_; |
371 | 384 |
372 // The count of currently visible widgets. Since the host can be a container | 385 // The count of currently visible widgets. Since the host can be a container |
373 // for multiple widgets, it uses this count to determine when it should be | 386 // for multiple widgets, it uses this count to determine when it should be |
374 // backgrounded. | 387 // backgrounded. |
(...skipping 25 matching lines...) Expand all Loading... |
400 // Stores the time at which the first call to Init happened. | 413 // Stores the time at which the first call to Init happened. |
401 base::TimeTicks init_time_; | 414 base::TimeTicks init_time_; |
402 | 415 |
403 // Used to launch and terminate the process without blocking the UI thread. | 416 // Used to launch and terminate the process without blocking the UI thread. |
404 std::unique_ptr<ChildProcessLauncher> child_process_launcher_; | 417 std::unique_ptr<ChildProcessLauncher> child_process_launcher_; |
405 | 418 |
406 // Messages we queue while waiting for the process handle. We queue them here | 419 // Messages we queue while waiting for the process handle. We queue them here |
407 // instead of in the channel so that we ensure they're sent after init related | 420 // instead of in the channel so that we ensure they're sent after init related |
408 // messages that are sent once the process handle is available. This is | 421 // messages that are sent once the process handle is available. This is |
409 // because the queued messages may have dependencies on the init messages. | 422 // because the queued messages may have dependencies on the init messages. |
410 std::queue<IPC::Message*> queued_messages_; | 423 std::queue<std::unique_ptr<IPC::Message>> queued_messages_; |
411 | 424 |
412 // The globally-unique identifier for this RPH. | 425 // The globally-unique identifier for this RPH. |
413 const int id_; | 426 const int id_; |
414 | 427 |
415 // A secondary ID used by the Mojo shell to distinguish different incarnations | 428 // A secondary ID used by the Mojo shell to distinguish different incarnations |
416 // of the same RPH from each other. Unlike |id_| this is not globally unique, | 429 // of the same RPH from each other. Unlike |id_| this is not globally unique, |
417 // but it is guaranteed to change every time Init() is called. | 430 // but it is guaranteed to change every time Init() is called. |
418 int instance_id_ = 1; | 431 int instance_id_ = 1; |
419 | 432 |
420 BrowserContext* browser_context_; | 433 BrowserContext* browser_context_; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 mojo::ScopedMessagePipeHandle in_process_renderer_handle_; | 527 mojo::ScopedMessagePipeHandle in_process_renderer_handle_; |
515 | 528 |
516 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; | 529 base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; |
517 | 530 |
518 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); | 531 DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); |
519 }; | 532 }; |
520 | 533 |
521 } // namespace content | 534 } // namespace content |
522 | 535 |
523 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ | 536 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_IMPL_H_ |
OLD | NEW |