Browse Source

build: fix build with enable_printing=false (#27456) (#27505)

Milan Burda 4 years ago
parent
commit
13a0757acb

+ 8 - 1
shell/browser/api/electron_api_web_contents.cc

@@ -452,7 +452,9 @@ WebContents::WebContents(v8::Isolate* isolate,
                          content::WebContents* web_contents)
     : content::WebContentsObserver(web_contents),
       type_(Type::REMOTE),
+#if BUILDFLAG(ENABLE_PRINTING)
       print_task_runner_(CreatePrinterHandlerTaskRunner()),
+#endif
       weak_factory_(this) {
 #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
   // WebContents created by extension host will have valid ViewType set.
@@ -487,7 +489,9 @@ WebContents::WebContents(v8::Isolate* isolate,
                          Type type)
     : content::WebContentsObserver(web_contents.get()),
       type_(type),
+#if BUILDFLAG(ENABLE_PRINTING)
       print_task_runner_(CreatePrinterHandlerTaskRunner()),
+#endif
       weak_factory_(this) {
   DCHECK(type != Type::REMOTE)
       << "Can't take ownership of a remote WebContents";
@@ -499,7 +503,10 @@ WebContents::WebContents(v8::Isolate* isolate,
 
 WebContents::WebContents(v8::Isolate* isolate,
                          const gin_helper::Dictionary& options)
-    : print_task_runner_(CreatePrinterHandlerTaskRunner()),
+    :
+#if BUILDFLAG(ENABLE_PRINTING)
+      print_task_runner_(CreatePrinterHandlerTaskRunner()),
+#endif
       weak_factory_(this) {
   // Read options.
   options.Get("backgroundThrottling", &background_throttling_);

+ 2 - 0
shell/browser/api/electron_api_web_contents.h

@@ -656,7 +656,9 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
   // -1 means no speculative RVH has been committed yet.
   int currently_committed_process_id_ = -1;
 
+#if BUILDFLAG(ENABLE_PRINTING)
   scoped_refptr<base::TaskRunner> print_task_runner_;
+#endif
 
   service_manager::BinderRegistryWithArgs<content::RenderFrameHost*> registry_;
   mojo::ReceiverSet<mojom::ElectronBrowser, content::RenderFrameHost*>