io_thread.h 1017 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) 2017 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef BRIGHTRAY_BROWSER_IO_THREAD_H_
  5. #define BRIGHTRAY_BROWSER_IO_THREAD_H_
  6. #include <memory>
  7. #include "base/macros.h"
  8. #include "content/public/browser/browser_thread_delegate.h"
  9. namespace net {
  10. class URLRequestContext;
  11. class URLRequestContextGetter;
  12. } // namespace net
  13. namespace brightray {
  14. class IOThread : public content::BrowserThreadDelegate {
  15. public:
  16. IOThread();
  17. ~IOThread() override;
  18. net::URLRequestContextGetter* GetRequestContext() {
  19. return url_request_context_getter_;
  20. }
  21. protected:
  22. // BrowserThreadDelegate Implementation, runs on the IO thread.
  23. void Init() override;
  24. void CleanUp() override;
  25. private:
  26. std::unique_ptr<net::URLRequestContext> url_request_context_;
  27. net::URLRequestContextGetter* url_request_context_getter_;
  28. DISALLOW_COPY_AND_ASSIGN(IOThread);
  29. };
  30. } // namespace brightray
  31. #endif // BRIGHTRAY_BROWSER_IO_THREAD_H_