Move debug_devtools to a buildflag_header.
Previously this was in the global features.gni file, and files did an ad-hoc reference to the debug_devtools config if they needed the define. This is fragile and will not scale as additional flags are added. This patch introduces a Blink public features buildflag_header (in the future I expect we'll also have a Blink-internal one in Source/). The existing users of debug_devtools are updated to use this. BUG= Review-Url: https://codereview.chromium.org/2458573004 Cr-Commit-Position: refs/heads/master@{#429362}
This commit is contained in:
build/config
chrome
BUILD.gnDEPS
browser
BUILD.gnDEPS
devtools
profiles
renderer_context_menu
ui
test
content
third_party/WebKit
@ -34,12 +34,6 @@ declare_args() {
|
||||
# Non-SFI is not yet supported on mipsel
|
||||
enable_nacl_nonsfi = current_cpu != "mipsel"
|
||||
|
||||
# If debug_devtools is set to true, JavaScript files for DevTools are stored
|
||||
# as is and loaded from disk. Otherwise, a concatenated file is stored in
|
||||
# resources.pak. It is still possible to load JS files from disk by passing
|
||||
# --debug-devtools cmdline switch.
|
||||
debug_devtools = false
|
||||
|
||||
# Enables WebRTC.
|
||||
enable_webrtc = !is_ios
|
||||
|
||||
|
@ -16,6 +16,7 @@ import("//chrome/chrome_paks.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
import("//chrome/process_version_rc_template.gni")
|
||||
import("//ppapi/features/features.gni")
|
||||
import("//third_party/WebKit/public/public_features.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
import("//tools/resources/generate_resource_whitelist.gni")
|
||||
import("//v8/gni/v8.gni")
|
||||
|
@ -36,6 +36,7 @@ include_rules = [
|
||||
|
||||
# Allow inclusion of WebKit API files.
|
||||
"+third_party/WebKit/public/platform",
|
||||
"+third_party/WebKit/public/public_features.h",
|
||||
"+third_party/WebKit/public/web",
|
||||
|
||||
# Allow inclusion of third-party code:
|
||||
|
@ -1257,7 +1257,6 @@ split_static_library("browser") {
|
||||
configs += [
|
||||
"//build/config/compiler:wexit_time_destructors",
|
||||
"//build/config:precompiled_headers",
|
||||
"//third_party/WebKit/public:debug_devtools",
|
||||
]
|
||||
defines = []
|
||||
libs = []
|
||||
@ -1445,6 +1444,7 @@ split_static_library("browser") {
|
||||
"//sql",
|
||||
"//storage/browser",
|
||||
"//storage/common",
|
||||
"//third_party/WebKit/public:features",
|
||||
"//third_party/WebKit/public:image_resources",
|
||||
"//third_party/WebKit/public:resources",
|
||||
"//third_party/cacheinvalidation",
|
||||
|
@ -101,6 +101,7 @@ include_rules = [
|
||||
"+third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h",
|
||||
"+third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h",
|
||||
"+third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h",
|
||||
"+third_party/WebKit/public/public_features.h",
|
||||
"+third_party/WebKit/public/web/WebCache.h",
|
||||
"+third_party/WebKit/public/web/WebContextMenuData.h",
|
||||
"+third_party/WebKit/public/web/WebFindOptions.h",
|
||||
|
@ -55,7 +55,6 @@ static_library("devtools") {
|
||||
"//build/config/compiler:no_size_t_to_int_warning",
|
||||
"//build/config/compiler:wexit_time_destructors",
|
||||
"//build/config:precompiled_headers",
|
||||
"//third_party/WebKit/public:debug_devtools",
|
||||
]
|
||||
|
||||
deps = [
|
||||
@ -63,6 +62,7 @@ static_library("devtools") {
|
||||
"//base",
|
||||
"//content/public/browser",
|
||||
"//net",
|
||||
"//third_party/WebKit/public:features",
|
||||
"//ui/events:dom_keycode_converter",
|
||||
]
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "net/log/net_log_source.h"
|
||||
#include "net/log/net_log_with_source.h"
|
||||
#include "net/socket/tcp_client_socket.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
@ -316,9 +317,9 @@ void PortForwardingController::Connection::SendCommand(
|
||||
pending_responses_[id] =
|
||||
base::Bind(&Connection::ProcessBindResponse,
|
||||
base::Unretained(this), port);
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
port_status_[port] = kStatusConnecting;
|
||||
#endif // defined(DEBUG_DEVTOOLS)
|
||||
#endif // BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
} else {
|
||||
PortStatusMap::iterator it = port_status_.find(port);
|
||||
if (it != port_status_.end() && it->second == kStatusError) {
|
||||
@ -330,9 +331,9 @@ void PortForwardingController::Connection::SendCommand(
|
||||
pending_responses_[id] =
|
||||
base::Bind(&Connection::ProcessUnbindResponse,
|
||||
base::Unretained(this), port);
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
port_status_[port] = kStatusDisconnecting;
|
||||
#endif // defined(DEBUG_DEVTOOLS)
|
||||
#endif // BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
}
|
||||
|
||||
web_socket_->SendFrame(
|
||||
|
@ -12,7 +12,8 @@
|
||||
#include "chrome/browser/devtools/device/android_device_manager.h"
|
||||
#include "net/base/host_port_pair.h"
|
||||
|
||||
// Instantiate this class only in a test and/or when DEBUG_DEVTOOLS is defined.
|
||||
// Instantiate this class only in a test and/or when the DEBUG_DEVTOOLS
|
||||
// BUILDFLAG is set.
|
||||
class TCPDeviceProvider : public AndroidDeviceManager::DeviceProvider {
|
||||
public:
|
||||
static scoped_refptr<TCPDeviceProvider> CreateForLocalhost(uint16_t port);
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/url_request/url_fetcher.h"
|
||||
#include "net/url_request/url_fetcher_response_writer.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
|
||||
@ -1167,7 +1168,7 @@ void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() {
|
||||
// In the DEBUG_DEVTOOLS mode, the DocumentOnLoadCompletedInMainFrame event
|
||||
// arrives before the LoadCompleted event, thus it should not trigger the
|
||||
// frontend load handling.
|
||||
#if !defined(DEBUG_DEVTOOLS)
|
||||
#if !BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
FrontendLoaded();
|
||||
#endif
|
||||
}
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "content/public/common/content_client.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "net/base/escape.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
#include "third_party/WebKit/public/web/WebInputEvent.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
@ -209,9 +210,9 @@ GURL DecorateFrontendURL(const GURL& base_url) {
|
||||
switches::kDevToolsFlags);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
url_string += "&debugFrontend=true";
|
||||
#endif // defined(DEBUG_DEVTOOLS)
|
||||
#endif // BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
|
||||
return GURL(url_string);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/log/net_log_source.h"
|
||||
#include "net/socket/tcp_server_socket.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace {
|
||||
@ -104,7 +105,7 @@ RemoteDebuggingServer::RemoteDebuggingServer(const std::string& ip,
|
||||
}
|
||||
|
||||
base::FilePath debug_frontend_dir;
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
PathService::Get(chrome::DIR_INSPECTOR_DEBUG, &debug_frontend_dir);
|
||||
#endif
|
||||
|
||||
|
@ -110,6 +110,7 @@
|
||||
#include "net/url_request/url_request_intercepting_job_factory.h"
|
||||
#include "net/url_request/url_request_interceptor.h"
|
||||
#include "net/url_request/url_request_job_factory_impl.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
|
||||
#if defined(ENABLE_EXTENSIONS)
|
||||
#include "chrome/browser/extensions/extension_cookie_monster_delegate.h"
|
||||
@ -178,7 +179,7 @@ namespace {
|
||||
|
||||
net::CertVerifier* g_cert_verifier_for_testing = nullptr;
|
||||
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) {
|
||||
std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath);
|
||||
bundled_path_prefix = "/" + bundled_path_prefix + "/";
|
||||
@ -244,7 +245,7 @@ class DebugDevToolsInterceptor : public net::URLRequestInterceptor {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
#endif // defined(DEBUG_DEVTOOLS)
|
||||
#endif // BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
|
||||
#if defined(OS_CHROMEOS)
|
||||
// The following four functions are responsible for initializing NSS for each
|
||||
@ -1232,7 +1233,7 @@ ProfileIOData::SetUpJobFactoryDefaults(
|
||||
url::kFtpScheme, net::FtpProtocolHandler::Create(host_resolver));
|
||||
#endif // !BUILDFLAG(DISABLE_FTP_SUPPORT)
|
||||
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
request_interceptors.push_back(new DebugDevToolsInterceptor);
|
||||
#endif
|
||||
|
||||
|
@ -105,6 +105,7 @@
|
||||
#include "content/public/common/menu_item.h"
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "net/base/escape.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
#include "third_party/WebKit/public/web/WebContextMenuData.h"
|
||||
#include "third_party/WebKit/public/web/WebMediaPlayerAction.h"
|
||||
#include "third_party/WebKit/public/web/WebPluginAction.h"
|
||||
@ -934,7 +935,7 @@ void RenderViewContextMenu::AppendDeveloperItems() {
|
||||
// devtools build.
|
||||
bool show_developer_items = !IsDevToolsURL(params_.page_url);
|
||||
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
show_developer_items = true;
|
||||
#endif
|
||||
|
||||
|
@ -435,7 +435,6 @@ split_static_library("ui") {
|
||||
":ui_warnings",
|
||||
"//build/config:precompiled_headers",
|
||||
"//build/config/compiler:wexit_time_destructors",
|
||||
"//third_party/WebKit/public:debug_devtools",
|
||||
]
|
||||
|
||||
# Since browser and browser_ui actually depend on each other,
|
||||
@ -569,6 +568,7 @@ split_static_library("ui") {
|
||||
"//skia",
|
||||
"//storage/browser",
|
||||
"//storage/common",
|
||||
"//third_party/WebKit/public:features",
|
||||
"//third_party/WebKit/public:resources",
|
||||
"//third_party/adobe/flash:flapper_version_h",
|
||||
"//third_party/brotli",
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "net/url_request/url_fetcher.h"
|
||||
#include "net/url_request/url_fetcher_delegate.h"
|
||||
#include "net/url_request/url_request_context_getter.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
using content::WebContents;
|
||||
@ -43,7 +44,7 @@ const char kRemoteFrontendBase[] =
|
||||
const char kRemoteFrontendPath[] = "serve_file";
|
||||
const char kHttpNotFound[] = "HTTP/1.1 404 Not Found\n\n";
|
||||
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
// Local frontend url provided by InspectUI.
|
||||
const char kFallbackFrontendURL[] =
|
||||
"chrome-devtools://devtools/bundled/inspector.html";
|
||||
@ -51,7 +52,7 @@ const char kFallbackFrontendURL[] =
|
||||
// URL causing the DevTools window to display a plain text warning.
|
||||
const char kFallbackFrontendURL[] =
|
||||
"data:text/plain,Cannot load DevTools frontend from an untrusted origin";
|
||||
#endif // defined(DEBUG_DEVTOOLS)
|
||||
#endif // BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
|
||||
GURL SanitizeFrontendURL(
|
||||
const GURL& url,
|
||||
|
@ -1219,10 +1219,7 @@ test("browser_tests") {
|
||||
# implemented. See crbug.com/611756
|
||||
]
|
||||
|
||||
configs += [
|
||||
"//build/config:precompiled_headers",
|
||||
"//third_party/WebKit/public:debug_devtools",
|
||||
]
|
||||
configs += [ "//build/config:precompiled_headers" ]
|
||||
|
||||
deps = [
|
||||
":browser_tests_runner",
|
||||
@ -1230,6 +1227,7 @@ test("browser_tests") {
|
||||
":test_support",
|
||||
"//base",
|
||||
"//components/sync:test_support_model",
|
||||
"//third_party/WebKit/public:features",
|
||||
]
|
||||
|
||||
data_deps = []
|
||||
|
@ -182,6 +182,7 @@ source_set("automation_client_lib") {
|
||||
"//base",
|
||||
"//base/third_party/dynamic_annotations",
|
||||
"//net",
|
||||
"//third_party/WebKit/public:features",
|
||||
"//third_party/zlib:minizip",
|
||||
"//third_party/zlib:zip",
|
||||
"//ui/accessibility:ax_gen",
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/log/net_log_source.h"
|
||||
#include "net/socket/tcp_client_socket.h"
|
||||
#include "third_party/WebKit/public/public_features.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -309,20 +310,20 @@ void AdbClientSocket::AdbQuery(int port,
|
||||
new AdbQuerySocket(port, query, callback);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
static void UseTransportQueryForDesktop(const SocketCallback& callback,
|
||||
net::StreamSocket* socket,
|
||||
int result) {
|
||||
callback.Run(result, socket);
|
||||
}
|
||||
#endif // defined(DEBUG_DEVTOOLS)
|
||||
#endif // BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
|
||||
// static
|
||||
void AdbClientSocket::TransportQuery(int port,
|
||||
const std::string& serial,
|
||||
const std::string& socket_name,
|
||||
const SocketCallback& callback) {
|
||||
#if defined(DEBUG_DEVTOOLS)
|
||||
#if BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
if (serial.empty()) {
|
||||
// Use plain socket for remote debugging on Desktop (debugging purposes).
|
||||
int tcp_port = 0;
|
||||
@ -336,7 +337,7 @@ void AdbClientSocket::TransportQuery(int port,
|
||||
socket->Connect(base::Bind(&UseTransportQueryForDesktop, callback, socket));
|
||||
return;
|
||||
}
|
||||
#endif // defined(DEBUG_DEVTOOLS)
|
||||
#endif // BUILDFLAG(DEBUG_DEVTOOLS)
|
||||
new AdbTransportSocket(port, serial, socket_name, callback);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ source_set("browser") {
|
||||
configs += [
|
||||
"//build/config:precompiled_headers",
|
||||
"//content:content_implementation",
|
||||
"//third_party/WebKit/public:debug_devtools",
|
||||
"//v8:external_startup_data",
|
||||
]
|
||||
defines = []
|
||||
|
@ -199,8 +199,6 @@ static_library("content_shell_lib") {
|
||||
|
||||
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
|
||||
"//build/config/compiler:no_size_t_to_int_warning",
|
||||
|
||||
"//third_party/WebKit/public:debug_devtools",
|
||||
]
|
||||
|
||||
defines = [ "CONTENT_SHELL_VERSION=\"$content_shell_version\"" ]
|
||||
@ -251,6 +249,7 @@ static_library("content_shell_lib") {
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//third_party/WebKit/public:blink",
|
||||
"//third_party/WebKit/public:features",
|
||||
"//third_party/WebKit/public:image_resources",
|
||||
"//third_party/WebKit/public:resources",
|
||||
"//third_party/WebKit/public:test_support",
|
||||
|
1
third_party/WebKit/Source/devtools/BUILD.gn
vendored
1
third_party/WebKit/Source/devtools/BUILD.gn
vendored
@ -3,6 +3,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/features.gni")
|
||||
import("//third_party/WebKit/public/public_features.gni")
|
||||
import("//third_party/WebKit/Source/core/core.gni")
|
||||
|
||||
devtools_embedder_scripts = [
|
||||
|
10
third_party/WebKit/public/BUILD.gn
vendored
10
third_party/WebKit/public/BUILD.gn
vendored
@ -2,7 +2,9 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/buildflag_header.gni")
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
import("//third_party/WebKit/public/public_features.gni")
|
||||
import("//third_party/WebKit/Source/config.gni")
|
||||
import("//tools/grit/grit_rule.gni")
|
||||
|
||||
@ -65,10 +67,10 @@ config("blink_headers_config") {
|
||||
configs = [ "//v8:external_config" ]
|
||||
}
|
||||
|
||||
config("debug_devtools") {
|
||||
if (debug_devtools) {
|
||||
defines = [ "DEBUG_DEVTOOLS=1" ]
|
||||
}
|
||||
# Public feature flags usabout outside of Blink.
|
||||
buildflag_header("features") {
|
||||
header = "public_features.h"
|
||||
flags = [ "DEBUG_DEVTOOLS=$debug_devtools" ]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
|
11
third_party/WebKit/public/public_features.gni
vendored
Normal file
11
third_party/WebKit/public/public_features.gni
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
declare_args() {
|
||||
# If debug_devtools is set to true, JavaScript files for DevTools are stored
|
||||
# as is and loaded from disk. Otherwise, a concatenated file is stored in
|
||||
# resources.pak. It is still possible to load JS files from disk by passing
|
||||
# --debug-devtools cmdline switch.
|
||||
debug_devtools = false
|
||||
}
|
Reference in New Issue
Block a user