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

Issue 1991953002: Implement a runtime headless mode for Linux (Closed)

Created:
4 years, 7 months ago by Sami
Modified:
4 years ago
CC:
chromium-reviews, danakj+watch_chromium.org, darin-cc_chromium.org, jam, jbauman+watch_chromium.org, kalyank, nona+watch_chromium.org, piman+watch_chromium.org, sadrul, shuchen+watch_chromium.org, sievers+watch_chromium.org, James Su, yusukes+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement a runtime headless mode for Linux This patch implements a runtime headless mode (i.e., a --headless command line switch) that makes it possible to use a regular Chrome binary as a headless. When the binary is launched with this switch, the main entrypoint calls into the Headless Shell entrypoint, effectively starting that shell instead of Chrome. To make this possible we must remove the dependency from Headless to Ozone, because Ozone is a build-time feature which is generally not enabled for regular Chrome builds. In practice this means implementing a new headless-specific WindowTreeHost and modifying various graphics and input entrypoints to do something appropriate in headless mode. Since many of the modifications are in platform-specific code, this initial patch only adds headless support in Linux. Other platforms will be added later. Design doc: https://docs.google.com/document/d/1aIJUzQr3eougZQp90bp4mqGr5gY6hdUice8UPa-Ys90/edit# BUG=612904 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Committed: https://crrev.com/b354f8865623b8ca8da43f7ef37332bdb586dd82 Cr-Commit-Position: refs/heads/master@{#438239}

Patch Set 1 #

Patch Set 2 : Rebased #

Patch Set 3 : Add --headless flag #

Patch Set 4 : Runtime switching works #

Patch Set 5 : More cleanup #

Patch Set 6 : Rebased #

Patch Set 7 : Rebased #

Total comments: 6

Patch Set 8 : Fixed screenshot test + review comments #

Patch Set 9 : Unify switches #

Patch Set 10 : Fix ozone deps #

Patch Set 11 : Rebased #

Patch Set 12 : Windows build fix #

Patch Set 13 : GPU watchdog fix #

Patch Set 14 : Mac build fix #

Total comments: 6

Patch Set 15 : Review nits #

Total comments: 2

Patch Set 16 : Add headless platform event source #

Total comments: 4

Patch Set 17 : Nits. #

Total comments: 4

Patch Set 18 : Review comments #

Total comments: 2

Patch Set 19 : Adjust DEPS #

Total comments: 2

Patch Set 20 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+276 lines, -132 lines) Patch
M chrome/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/app/DEPS View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -0 lines 0 comments Download
M chrome/app/chrome_main.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +13 lines, -5 lines 0 comments Download
M content/browser/browser_main_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +5 lines, -1 line 0 comments Download
M content/browser/compositor/gpu_process_transport_factory.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +9 lines, -0 lines 0 comments Download
M content/browser/gpu/gpu_process_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/zygote_host/zygote_communication_linux.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -0 lines 0 comments Download
M content/gpu/gpu_main.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +25 lines, -20 lines 0 comments Download
M gpu/ipc/service/gpu_init.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +2 lines, -0 lines 0 comments Download
M headless/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +9 lines, -8 lines 0 comments Download
M headless/DEPS View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +6 lines, -1 line 0 comments Download
M headless/README.md View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download
M headless/lib/browser/headless_browser_impl.cc View 1 2 3 4 2 chunks +5 lines, -2 lines 0 comments Download
A headless/lib/browser/headless_platform_event_source.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +26 lines, -0 lines 0 comments Download
A headless/lib/browser/headless_platform_event_source.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +13 lines, -0 lines 0 comments Download
M headless/lib/browser/headless_web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -1 line 0 comments Download
A headless/lib/browser/headless_window_tree_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +48 lines, -0 lines 0 comments Download
A headless/lib/browser/headless_window_tree_host.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +75 lines, -0 lines 0 comments Download
M headless/lib/headless_content_main_delegate.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +2 lines, -6 lines 0 comments Download
M headless/lib/headless_content_main_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +7 lines, -14 lines 0 comments Download
D headless/lib/renderer/headless_content_renderer_client.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -22 lines 0 comments Download
D headless/lib/renderer/headless_content_renderer_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -16 lines 0 comments Download
D headless/lib/utility/headless_content_utility_client.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -22 lines 0 comments Download
D headless/lib/utility/headless_content_utility_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +0 lines, -13 lines 0 comments Download
M ui/base/ime/input_method_factory.cc View 1 2 3 4 5 6 7 8 9 2 chunks +5 lines, -0 lines 0 comments Download
M ui/gfx/icc_profile_x11.cc View 1 2 3 4 2 chunks +4 lines, -1 line 0 comments Download
M ui/gfx/switches.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gfx/switches.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
M ui/gl/init/gl_initializer_x11.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +6 lines, -0 lines 0 comments Download

Messages

Total messages: 100 (72 generated)
Eric Seckler
https://codereview.chromium.org/1991953002/diff/120001/content/gpu/gpu_main.cc File content/gpu/gpu_main.cc (right): https://codereview.chromium.org/1991953002/diff/120001/content/gpu/gpu_main.cc#newcode204 content/gpu/gpu_main.cc:204: base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); think this won't compile, needs to do ...
4 years ago (2016-11-28 15:51:49 UTC) #13
Sami
https://codereview.chromium.org/1991953002/diff/120001/content/gpu/gpu_main.cc File content/gpu/gpu_main.cc (right): https://codereview.chromium.org/1991953002/diff/120001/content/gpu/gpu_main.cc#newcode204 content/gpu/gpu_main.cc:204: base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); On 2016/11/28 15:51:48, Eric Seckler wrote: > ...
4 years ago (2016-11-28 18:00:37 UTC) #14
Sami
Okay, the bots seem happier now. Eric, wanna look at headless/ again? Sadrul, could you ...
4 years ago (2016-12-01 18:50:57 UTC) #45
Eric Seckler
On 2016/12/01 18:50:57, Sami wrote: > Okay, the bots seem happier now. Eric, wanna look ...
4 years ago (2016-12-02 10:00:56 UTC) #48
Eric Seckler
and here go the nits .. https://codereview.chromium.org/1991953002/diff/260001/headless/lib/browser/headless_window_tree_host.h File headless/lib/browser/headless_window_tree_host.h (right): https://codereview.chromium.org/1991953002/diff/260001/headless/lib/browser/headless_window_tree_host.h#newcode10 headless/lib/browser/headless_window_tree_host.h:10: #include <memory> nit: ...
4 years ago (2016-12-02 10:01:15 UTC) #49
Sami
Thanks Eric, all nits addressed. https://codereview.chromium.org/1991953002/diff/260001/headless/lib/browser/headless_window_tree_host.h File headless/lib/browser/headless_window_tree_host.h (right): https://codereview.chromium.org/1991953002/diff/260001/headless/lib/browser/headless_window_tree_host.h#newcode10 headless/lib/browser/headless_window_tree_host.h:10: #include <memory> On 2016/12/02 ...
4 years ago (2016-12-02 11:30:24 UTC) #51
Sami
Ah, looks like Sadrul is out. Scott, would you like to look at the changes ...
4 years ago (2016-12-06 10:41:44 UTC) #56
sky
https://codereview.chromium.org/1991953002/diff/280001/ui/aura/env.cc File ui/aura/env.cc (right): https://codereview.chromium.org/1991953002/diff/280001/ui/aura/env.cc#newcode178 ui/aura/env.cc:178: if (RunningInHeadlessMode()) Would it make more sense for a ...
4 years ago (2016-12-06 14:27:32 UTC) #57
Sami
https://codereview.chromium.org/1991953002/diff/280001/ui/aura/env.cc File ui/aura/env.cc (right): https://codereview.chromium.org/1991953002/diff/280001/ui/aura/env.cc#newcode178 ui/aura/env.cc:178: if (RunningInHeadlessMode()) On 2016/12/06 14:27:31, sky wrote: > Would ...
4 years ago (2016-12-07 11:51:26 UTC) #60
Sami
sky@: Friendly ping.
4 years ago (2016-12-08 15:43:58 UTC) #63
sky
LGTM https://codereview.chromium.org/1991953002/diff/300001/headless/lib/browser/headless_platform_event_source.h File headless/lib/browser/headless_platform_event_source.h (right): https://codereview.chromium.org/1991953002/diff/300001/headless/lib/browser/headless_platform_event_source.h#newcode17 headless/lib/browser/headless_platform_event_source.h:17: }; private: DISALLOW... https://codereview.chromium.org/1991953002/diff/300001/ui/aura/env.cc File ui/aura/env.cc (right): https://codereview.chromium.org/1991953002/diff/300001/ui/aura/env.cc#newcode21 ...
4 years ago (2016-12-08 16:16:36 UTC) #64
Sami
Thanks! Jochen, could you check chrome/ and content/ please? Also +zmo@ for gpu/. https://codereview.chromium.org/1991953002/diff/300001/headless/lib/browser/headless_platform_event_source.h File ...
4 years ago (2016-12-08 16:58:36 UTC) #67
jochen (gone - plz use gerrit)
https://codereview.chromium.org/1991953002/diff/320001/chrome/DEPS File chrome/DEPS (right): https://codereview.chromium.org/1991953002/diff/320001/chrome/DEPS#newcode37 chrome/DEPS:37: "+headless", please move this to more specific files, so ...
4 years ago (2016-12-09 08:25:00 UTC) #72
Sami
https://codereview.chromium.org/1991953002/diff/320001/chrome/DEPS File chrome/DEPS (right): https://codereview.chromium.org/1991953002/diff/320001/chrome/DEPS#newcode37 chrome/DEPS:37: "+headless", On 2016/12/09 08:25:00, jochen wrote: > please move ...
4 years ago (2016-12-09 14:06:46 UTC) #75
jochen (gone - plz use gerrit)
lgtm with final comment addressed https://codereview.chromium.org/1991953002/diff/340001/headless/DEPS File headless/DEPS (right): https://codereview.chromium.org/1991953002/diff/340001/headless/DEPS#newcode2 headless/DEPS:2: "+content/public", could you restrict ...
4 years ago (2016-12-09 14:30:16 UTC) #76
Sami
https://codereview.chromium.org/1991953002/diff/340001/headless/DEPS File headless/DEPS (right): https://codereview.chromium.org/1991953002/diff/340001/headless/DEPS#newcode2 headless/DEPS:2: "+content/public", On 2016/12/09 14:30:16, jochen wrote: > could you ...
4 years ago (2016-12-09 14:36:50 UTC) #77
Sami
Not sure if zmo@ is around...Victor, could you have a look at gpu/ please?
4 years ago (2016-12-12 11:07:04 UTC) #79
Zhenyao Mo
https://codereview.chromium.org/1991953002/diff/360001/gpu/ipc/service/gpu_init.cc File gpu/ipc/service/gpu_init.cc (right): https://codereview.chromium.org/1991953002/diff/360001/gpu/ipc/service/gpu_init.cc#newcode131 gpu/ipc/service/gpu_init.cc:131: !command_line.HasSwitch(switches::kHeadless) && Can you explain why this is needed?
4 years ago (2016-12-12 18:21:43 UTC) #80
Sami
https://codereview.chromium.org/1991953002/diff/360001/gpu/ipc/service/gpu_init.cc File gpu/ipc/service/gpu_init.cc (right): https://codereview.chromium.org/1991953002/diff/360001/gpu/ipc/service/gpu_init.cc#newcode131 gpu/ipc/service/gpu_init.cc:131: !command_line.HasSwitch(switches::kHeadless) && On 2016/12/12 18:21:43, Zhenyao Mo wrote: > ...
4 years ago (2016-12-12 20:04:13 UTC) #81
Zhenyao Mo
On 2016/12/12 20:04:13, Sami wrote: > https://codereview.chromium.org/1991953002/diff/360001/gpu/ipc/service/gpu_init.cc > File gpu/ipc/service/gpu_init.cc (right): > > https://codereview.chromium.org/1991953002/diff/360001/gpu/ipc/service/gpu_init.cc#newcode131 > ...
4 years ago (2016-12-12 21:30:34 UTC) #82
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/1991953002/380001
4 years ago (2016-12-13 11:30:28 UTC) #85
commit-bot: I haz the power
Committed patchset #20 (id:380001)
4 years ago (2016-12-13 13:26:27 UTC) #88
commit-bot: I haz the power
Patchset 20 (id:??) landed as https://crrev.com/eb0f3b0218478f30858dfa2078cb350ea259701f Cr-Commit-Position: refs/heads/master@{#438152}
4 years ago (2016-12-13 13:29:27 UTC) #90
Sami
A revert of this CL (patchset #20 id:380001) has been created in https://codereview.chromium.org/2570873002/ by skyostil@chromium.org. ...
4 years ago (2016-12-13 15:47:51 UTC) #91
Sami
Relanding now that the static initializers have been dealt with (https://codereview.chromium.org/2577483002/).
4 years ago (2016-12-13 18:33:00 UTC) #93
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/1991953002/380001
4 years ago (2016-12-13 18:34:14 UTC) #95
commit-bot: I haz the power
Committed patchset #20 (id:380001)
4 years ago (2016-12-13 18:43:20 UTC) #98
commit-bot: I haz the power
4 years ago (2016-12-13 18:45:24 UTC) #100
Message was sent while issue was closed.
Patchset 20 (id:??) landed as
https://crrev.com/b354f8865623b8ca8da43f7ef37332bdb586dd82
Cr-Commit-Position: refs/heads/master@{#438239}

Powered by Google App Engine
This is Rietveld 408576698