blob: 5f29b4819436fa14dc9f6f3353bdc321e7c66fc7 [file] [log] [blame]
[email protected]ef2bf422012-05-11 03:27:091// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]0ac83682010-01-22 17:46:272// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]b0f146f2011-09-15 22:14:255#ifndef CONTENT_BROWSER_BROWSER_PROCESS_SUB_THREAD_H_
6#define CONTENT_BROWSER_BROWSER_PROCESS_SUB_THREAD_H_
[email protected]0ac83682010-01-22 17:46:277
dcheng59716272016-04-09 05:19:088#include <memory>
9
avib7348942015-12-25 20:57:1010#include "base/macros.h"
11#include "build/build_config.h"
[email protected]c38831a12011-10-28 12:44:4912#include "content/browser/browser_thread_impl.h"
[email protected]84c13c032011-09-23 00:12:2213#include "content/common/content_export.h"
[email protected]0ac83682010-01-22 17:46:2714
[email protected]451fd902012-10-03 17:14:4815#if defined(OS_WIN)
16namespace base {
17namespace win {
18class ScopedCOMInitializer;
19}
20}
21#endif
22
[email protected]ad50def52011-10-19 23:17:0723namespace content {
[email protected]0ac83682010-01-22 17:46:2724class NotificationService;
[email protected]ad50def52011-10-19 23:17:0725}
[email protected]0ac83682010-01-22 17:46:2726
[email protected]c38831a12011-10-28 12:44:4927namespace content {
28
[email protected]0ac83682010-01-22 17:46:2729// ----------------------------------------------------------------------------
30// BrowserProcessSubThread
31//
32// This simple thread object is used for the specialized threads that the
33// BrowserProcess spins up.
34//
35// Applications must initialize the COM library before they can call
36// COM library functions other than CoGetMalloc and memory allocation
37// functions, so this class initializes COM for those users.
[email protected]c38831a12011-10-28 12:44:4938class CONTENT_EXPORT BrowserProcessSubThread : public BrowserThreadImpl {
[email protected]0ac83682010-01-22 17:46:2739 public:
[email protected]d04e7662010-10-10 22:24:4840 explicit BrowserProcessSubThread(BrowserThread::ID identifier);
boliu61687ec52017-03-29 20:09:3441 BrowserProcessSubThread(BrowserThread::ID identifier,
42 base::MessageLoop* message_loop);
dchengc2282aa2014-10-21 12:07:5843 ~BrowserProcessSubThread() override;
[email protected]0ac83682010-01-22 17:46:2744
45 protected:
dchengc2282aa2014-10-21 12:07:5846 void Init() override;
47 void CleanUp() override;
[email protected]0ac83682010-01-22 17:46:2748
49 private:
[email protected]af669932012-01-17 19:26:5850 // These methods encapsulate cleanup that needs to happen on the IO thread
[email protected]ef2bf422012-05-11 03:27:0951 // before we call the embedder's CleanUp function.
[email protected]af669932012-01-17 19:26:5852 void IOThreadPreCleanUp();
[email protected]af669932012-01-17 19:26:5853
[email protected]451fd902012-10-03 17:14:4854#if defined (OS_WIN)
dcheng59716272016-04-09 05:19:0855 std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer_;
[email protected]451fd902012-10-03 17:14:4856#endif
57
[email protected]0ac83682010-01-22 17:46:2758 // Each specialized thread has its own notification service.
dcheng59716272016-04-09 05:19:0859 std::unique_ptr<NotificationService> notification_service_;
[email protected]0ac83682010-01-22 17:46:2760
61 DISALLOW_COPY_AND_ASSIGN(BrowserProcessSubThread);
62};
63
[email protected]c38831a12011-10-28 12:44:4964} // namespace content
65
[email protected]b0f146f2011-09-15 22:14:2566#endif // CONTENT_BROWSER_BROWSER_PROCESS_SUB_THREAD_H_