From c4d192b9a4f43da0cafd3c5bedff68adcfce5a76 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 21 Aug 2015 16:14:19 +0800 Subject: [PATCH] linux: Fix building --- brightray/browser/browser_client.cc | 35 ------------------- brightray/browser/browser_client.h | 12 ------- .../browser/devtools_manager_delegate.cc | 7 ++++ 3 files changed, 7 insertions(+), 47 deletions(-) diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index 4bbf371aeaa0..18b5fd855e25 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -10,11 +10,8 @@ #include "browser/media/media_capture_devices_dispatcher.h" #include "browser/platform_notification_service_impl.h" -#include "base/base_paths.h" #include "base/path_service.h" -#include "content/public/common/content_descriptors.h" #include "content/public/common/url_constants.h" -#include "gin/public/isolate_holder.h" namespace brightray { @@ -32,11 +29,6 @@ BrowserClient::BrowserClient() : browser_main_parts_(nullptr) { DCHECK(!g_browser_client); g_browser_client = this; - -#if defined(OS_POSIX) && !defined(OS_MACOSX) - v8_natives_fd_.reset(-1); - v8_snapshot_fd_.reset(-1); -#endif // OS_POSIX && !OS_MACOSX } BrowserClient::~BrowserClient() { @@ -99,31 +91,4 @@ content::DevToolsManagerDelegate* BrowserClient::GetDevToolsManagerDelegate() { return new DevToolsManagerDelegate; } -#if defined(OS_POSIX) && !defined(OS_MACOSX) -void BrowserClient::GetAdditionalMappedFilesForChildProcess( - const base::CommandLine& command_line, - int child_process_id, - content::FileDescriptorInfo* mappings) { - if (v8_snapshot_fd_.get() == -1 && v8_natives_fd_.get() == -1) { - base::FilePath v8_data_path; - PathService::Get(gin::IsolateHolder::kV8SnapshotBasePathKey, &v8_data_path); - DCHECK(!v8_data_path.empty()); - - int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ; - base::FilePath v8_natives_data_path = - v8_data_path.AppendASCII(gin::IsolateHolder::kNativesFileName); - base::FilePath v8_snapshot_data_path = - v8_data_path.AppendASCII(gin::IsolateHolder::kSnapshotFileName); - base::File v8_natives_data_file(v8_natives_data_path, file_flags); - base::File v8_snapshot_data_file(v8_snapshot_data_path, file_flags); - DCHECK(v8_natives_data_file.IsValid()); - DCHECK(v8_snapshot_data_file.IsValid()); - v8_natives_fd_.reset(v8_natives_data_file.TakePlatformFile()); - v8_snapshot_fd_.reset(v8_snapshot_data_file.TakePlatformFile()); - } - mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); - mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); -} -#endif - } // namespace brightray diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index 1c8d256ce3d2..f69b017e5e10 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -46,20 +46,8 @@ class BrowserClient : public content::ContentBrowserClient { net::NetLog* GetNetLog() override; base::FilePath GetDefaultDownloadDirectory() override; content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; -#if defined(OS_POSIX) && !defined(OS_MACOSX) - void GetAdditionalMappedFilesForChildProcess( - const base::CommandLine& command_line, - int child_process_id, - content::FileDescriptorInfo* mappings) override; -#endif BrowserMainParts* browser_main_parts_; - -#if defined(OS_POSIX) && !defined(OS_MACOSX) - base::ScopedFD v8_natives_fd_; - base::ScopedFD v8_snapshot_fd_; -#endif // OS_POSIX && !OS_MACOSX - NetLog net_log_; DISALLOW_COPY_AND_ASSIGN(BrowserClient); diff --git a/brightray/browser/devtools_manager_delegate.cc b/brightray/browser/devtools_manager_delegate.cc index 0491d8aa859c..89c3469fc0d7 100644 --- a/brightray/browser/devtools_manager_delegate.cc +++ b/brightray/browser/devtools_manager_delegate.cc @@ -14,6 +14,7 @@ #include "base/strings/utf_string_conversions.h" #include "common/content_client.h" #include "components/devtools_discovery/basic_target_descriptor.h" +#include "components/devtools_discovery/devtools_discovery_manager.h" #include "components/devtools_http_handler/devtools_http_handler.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_frontend_host.h" @@ -140,6 +141,12 @@ DevToolsManagerDelegate::CreateHttpHandler() { } DevToolsManagerDelegate::DevToolsManagerDelegate() { + // NB(zcbenz): This call does nothing, the only purpose is to make sure the + // devtools_discovery module is linked into the final executable on Linux. + // Though it is possible to achieve this by modifying the gyp settings, it + // would greatly increase gyp file's complexity, so I chose to instead do + // this hack. + devtools_discovery::DevToolsDiscoveryManager::GetInstance(); } DevToolsManagerDelegate::~DevToolsManagerDelegate() {