diff options
author | bashi <bashi@chromium.org> | 2016-01-18 16:40:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-19 00:42:52 +0000 |
commit | 9813e8125b228b6918d71312538614354f6a40ec (patch) | |
tree | 6fd39fba6695967d6ff15285001a385c8bf32780 | |
parent | 833a437f479bdd1653b0eff8fb5e75883df7ae88 (diff) | |
download | chromium_src-9813e8125b228b6918d71312538614354f6a40ec.zip chromium_src-9813e8125b228b6918d71312538614354f6a40ec.tar.gz chromium_src-9813e8125b228b6918d71312538614354f6a40ec.tar.bz2 |
Remove some tracing methods from blink::Platform
Now we can directly use trace_event macros to implement EventTracer. Remove
unnecessary indirections. This is also a preparation to add
EstimateTraceMemoryOverhead() to blink's TracedValue.
BUG=561879, 570961
Review URL: https://codereview.chromium.org/1544123002
Cr-Commit-Position: refs/heads/master@{#370066}
-rw-r--r-- | components/html_viewer/blink_platform_impl.cc | 6 | ||||
-rw-r--r-- | components/html_viewer/blink_platform_impl.h | 2 | ||||
-rw-r--r-- | components/web_view/web_view_impl.cc | 12 | ||||
-rw-r--r-- | content/child/blink_platform_impl.cc | 95 | ||||
-rw-r--r-- | content/child/blink_platform_impl.h | 20 | ||||
-rw-r--r-- | media/blink/run_all_unittests.cc | 8 | ||||
-rw-r--r-- | third_party/WebKit/Source/platform/EventTracer.cpp | 80 | ||||
-rw-r--r-- | third_party/WebKit/Source/platform/EventTracer.h | 21 | ||||
-rw-r--r-- | third_party/WebKit/Source/platform/blink_platform.gypi | 1 | ||||
-rw-r--r-- | third_party/WebKit/Source/platform/exported/WebConvertableToTraceFormat.cpp | 37 | ||||
-rw-r--r-- | third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp | 6 | ||||
-rw-r--r-- | third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h | 1 | ||||
-rw-r--r-- | third_party/WebKit/public/blink_headers.gypi | 1 | ||||
-rw-r--r-- | third_party/WebKit/public/platform/Platform.h | 102 | ||||
-rw-r--r-- | third_party/WebKit/public/platform/WebConvertableToTraceFormat.h | 43 |
15 files changed, 80 insertions, 355 deletions
diff --git a/components/html_viewer/blink_platform_impl.cc b/components/html_viewer/blink_platform_impl.cc index c3d5d1a..714f16f 100644 --- a/components/html_viewer/blink_platform_impl.cc +++ b/components/html_viewer/blink_platform_impl.cc @@ -153,12 +153,6 @@ blink::WebScrollbarBehavior* BlinkPlatformImpl::scrollbarBehavior() { return &scrollbar_behavior_; } -const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( - const char* category_name) { - static const unsigned char buf[] = "*"; - return buf; -} - blink::WebGraphicsContext3D* BlinkPlatformImpl::createOffscreenGraphicsContext3D( const blink::WebGraphicsContext3D::Attributes& attributes, diff --git a/components/html_viewer/blink_platform_impl.h b/components/html_viewer/blink_platform_impl.h index df74298..0494d1c 100644 --- a/components/html_viewer/blink_platform_impl.h +++ b/components/html_viewer/blink_platform_impl.h @@ -77,8 +77,6 @@ class BlinkPlatformImpl : public blink::Platform { blink::WebWaitableEvent* waitMultipleEvents( const blink::WebVector<blink::WebWaitableEvent*>& events) override; blink::WebScrollbarBehavior* scrollbarBehavior() override; - const unsigned char* getTraceCategoryEnabledFlag( - const char* category_name) override; blink::WebGraphicsContext3D* createOffscreenGraphicsContext3D( const blink::WebGraphicsContext3D::Attributes& attributes, blink::WebGraphicsContext3D* share_context) override; diff --git a/components/web_view/web_view_impl.cc b/components/web_view/web_view_impl.cc index 6d140cb..e07f3cf 100644 --- a/components/web_view/web_view_impl.cc +++ b/components/web_view/web_view_impl.cc @@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/command_line.h" -#include "components/devtools_service/public/cpp/switches.h" #include "components/mus/public/cpp/scoped_window_ptr.h" #include "components/mus/public/cpp/window.h" #include "components/mus/public/cpp/window_tree_connection.h" @@ -26,14 +25,6 @@ #include "url/gurl.h" namespace web_view { -namespace { - -bool EnableRemoteDebugging() { - return base::CommandLine::ForCurrentProcess()->HasSwitch( - devtools_service::kRemoteDebuggingPort); -} - -} // namespace using web_view::mojom::ButtonState; @@ -50,8 +41,7 @@ WebViewImpl::WebViewImpl(mojo::ApplicationImpl* app, content_(nullptr), find_controller_(this), navigation_controller_(this) { - if (EnableRemoteDebugging()) - devtools_agent_.reset(new FrameDevToolsAgent(app_, this)); + devtools_agent_.reset(new FrameDevToolsAgent(app_, this)); OnDidNavigate(); } diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index 0b7f0a7..1e4b72d 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -63,7 +63,6 @@ #include "net/base/ip_address_number.h" #include "net/base/net_errors.h" #include "net/base/port_util.h" -#include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" #include "third_party/WebKit/public/platform/WebData.h" #include "third_party/WebKit/public/platform/WebFloatPoint.h" #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" @@ -159,25 +158,6 @@ class MemoryUsageCache { base::Lock lock_; }; -class ConvertableToTraceFormatWrapper - : public base::trace_event::ConvertableToTraceFormat { - public: - // We move a reference pointer from |convertable| to |convertable_|, - // rather than copying, for thread safety. https://crbug.com/478149 - explicit ConvertableToTraceFormatWrapper( - blink::WebConvertableToTraceFormat& convertable) { - convertable_.moveFrom(convertable); - } - void AppendAsTraceFormat(std::string* out) const override { - *out += convertable_.asTraceFormat().utf8(); - } - - private: - ~ConvertableToTraceFormatWrapper() override {} - - blink::WebConvertableToTraceFormat convertable_; -}; - } // namespace static int ToMessageID(WebLocalizedString::Name name) { @@ -634,81 +614,6 @@ void BlinkPlatformImpl::histogramSparse(const char* name, int sample) { UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); } -const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( - const char* category_group) { - return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); -} - -blink::Platform::TraceEventAPIAtomicWord* -BlinkPlatformImpl::getTraceSamplingState(const unsigned thread_bucket) { - switch (thread_bucket) { - case 0: - return reinterpret_cast<blink::Platform::TraceEventAPIAtomicWord*>( - &TRACE_EVENT_API_THREAD_BUCKET(0)); - case 1: - return reinterpret_cast<blink::Platform::TraceEventAPIAtomicWord*>( - &TRACE_EVENT_API_THREAD_BUCKET(1)); - case 2: - return reinterpret_cast<blink::Platform::TraceEventAPIAtomicWord*>( - &TRACE_EVENT_API_THREAD_BUCKET(2)); - default: - NOTREACHED() << "Unknown thread bucket type."; - } - return NULL; -} - -static_assert( - sizeof(blink::Platform::TraceEventHandle) == - sizeof(base::trace_event::TraceEventHandle), - "TraceEventHandle types must be same size"); - -blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( - char phase, - const unsigned char* category_group_enabled, - const char* name, - unsigned long long id, - unsigned long long bind_id, - double timestamp, - int num_args, - const char** arg_names, - const unsigned char* arg_types, - const unsigned long long* arg_values, - blink::WebConvertableToTraceFormat* convertable_values, - unsigned int flags) { - scoped_refptr<base::trace_event::ConvertableToTraceFormat> - convertable_wrappers[2]; - if (convertable_values) { - size_t size = std::min(static_cast<size_t>(num_args), - arraysize(convertable_wrappers)); - for (size_t i = 0; i < size; ++i) { - if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { - convertable_wrappers[i] = - new ConvertableToTraceFormatWrapper(convertable_values[i]); - } - } - } - base::TimeTicks timestamp_tt = - base::TimeTicks() + base::TimeDelta::FromSecondsD(timestamp); - base::trace_event::TraceEventHandle handle = - TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( - phase, category_group_enabled, name, id, bind_id, - base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, - arg_types, arg_values, convertable_wrappers, flags); - blink::Platform::TraceEventHandle result; - memcpy(&result, &handle, sizeof(result)); - return result; -} - -void BlinkPlatformImpl::updateTraceEventDuration( - const unsigned char* category_group_enabled, - const char* name, - TraceEventHandle handle) { - base::trace_event::TraceEventHandle traceEventHandle; - memcpy(&traceEventHandle, &handle, sizeof(handle)); - TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( - category_group_enabled, name, traceEventHandle); -} - void BlinkPlatformImpl::registerMemoryDumpProvider( blink::WebMemoryDumpProvider* wmdp, const char* name) { WebMemoryDumpProviderAdapter* wmdp_adapter = diff --git a/content/child/blink_platform_impl.h b/content/child/blink_platform_impl.h index ea44ffc..c245d4f 100644 --- a/content/child/blink_platform_impl.h +++ b/content/child/blink_platform_impl.h @@ -119,26 +119,6 @@ class CONTENT_EXPORT BlinkPlatformImpl int sample, int boundary_value) override; void histogramSparse(const char* name, int sample) override; - const unsigned char* getTraceCategoryEnabledFlag( - const char* category_name) override; - TraceEventAPIAtomicWord* getTraceSamplingState( - const unsigned thread_bucket) override; - TraceEventHandle addTraceEvent( - char phase, - const unsigned char* category_group_enabled, - const char* name, - unsigned long long id, - unsigned long long bind_id, - double timestamp, - int num_args, - const char** arg_names, - const unsigned char* arg_types, - const unsigned long long* arg_values, - blink::WebConvertableToTraceFormat* convertable_values, - unsigned int flags) override; - void updateTraceEventDuration(const unsigned char* category_group_enabled, - const char* name, - TraceEventHandle) override; void registerMemoryDumpProvider(blink::WebMemoryDumpProvider* wmdp, const char* name) override; void unregisterMemoryDumpProvider( diff --git a/media/blink/run_all_unittests.cc b/media/blink/run_all_unittests.cc index b3a946d..bcbc4e3 100644 --- a/media/blink/run_all_unittests.cc +++ b/media/blink/run_all_unittests.cc @@ -70,8 +70,6 @@ class TestBlinkPlatformSupport : NON_EXPORTED_BASE(public blink::Platform) { public: ~TestBlinkPlatformSupport() override; - const unsigned char* getTraceCategoryEnabledFlag( - const char* categoryName) override; blink::WebThread* currentThread() override { return &m_currentThread; } private: @@ -80,12 +78,6 @@ class TestBlinkPlatformSupport : NON_EXPORTED_BASE(public blink::Platform) { TestBlinkPlatformSupport::~TestBlinkPlatformSupport() {} -const unsigned char* TestBlinkPlatformSupport::getTraceCategoryEnabledFlag( - const char* categoryName) { - static const unsigned char tracingIsDisabled = 0; - return &tracingIsDisabled; -} - class BlinkMediaTestSuite : public base::TestSuite { public: BlinkMediaTestSuite(int argc, char** argv); diff --git a/third_party/WebKit/Source/platform/EventTracer.cpp b/third_party/WebKit/Source/platform/EventTracer.cpp index 30a8f11..08469ce 100644 --- a/third_party/WebKit/Source/platform/EventTracer.cpp +++ b/third_party/WebKit/Source/platform/EventTracer.cpp @@ -31,17 +31,45 @@ #include "platform/EventTracer.h" #include "base/time/time.h" +#include "base/trace_event/trace_event.h" #include "public/platform/Platform.h" -#include "public/platform/WebConvertableToTraceFormat.h" #include "wtf/Assertions.h" +#include "wtf/text/StringUTF8Adaptor.h" #include <stdio.h> namespace blink { -static_assert(sizeof(Platform::TraceEventHandle) == sizeof(TraceEvent::TraceEventHandle), "TraceEventHandle types must be compatible"); -static_assert(sizeof(Platform::TraceEventAPIAtomicWord) == sizeof(TraceEvent::TraceEventAPIAtomicWord), "TraceEventAPIAtomicWord types must be compatible"); +static_assert(sizeof(TraceEvent::TraceEventHandle) == sizeof(base::trace_event::TraceEventHandle), "TraceEventHandle types must be the same"); static_assert(sizeof(TraceEvent::TraceEventAPIAtomicWord) == sizeof(const char*), "TraceEventAPIAtomicWord must be pointer-sized."); +namespace { + +class ConvertableToTraceFormatWrapper : public base::trace_event::ConvertableToTraceFormat { +public: + // We move a reference pointer from |convertable| to |m_convertable|, + // rather than copying, for thread safety. https://crbug.com/478149 + explicit ConvertableToTraceFormatWrapper(PassRefPtr<blink::TraceEvent::ConvertableToTraceFormat> convertable) + : m_convertable(convertable) + { + ASSERT(m_convertable); + } + void AppendAsTraceFormat(std::string* out) const override + { + // TODO(bashi): Avoid copying. + String traceFormat = m_convertable->asTraceFormat(); + StringUTF8Adaptor utf8(traceFormat); + out->append(utf8.data(), utf8.length()); + } + // TODO(bashi): Override EstimateTraceMemoryOverhead() + +private: + ~ConvertableToTraceFormatWrapper() override {} + + RefPtr<blink::TraceEvent::ConvertableToTraceFormat> m_convertable; +}; + +} // namespace + // The dummy variable is needed to avoid a crash when someone updates the state variables // before EventTracer::initialize() is called. TraceEvent::TraceEventAPIAtomicWord dummyTraceSamplingState = 0; @@ -49,30 +77,21 @@ TraceEvent::TraceEventAPIAtomicWord* traceSamplingState[3] = {&dummyTraceSamplin void EventTracer::initialize() { - // current() might not exist in unit tests. - if (!Platform::current()) - return; - - traceSamplingState[0] = Platform::current()->getTraceSamplingState(0); + traceSamplingState[0] = reinterpret_cast<TraceEvent::TraceEventAPIAtomicWord*>(&TRACE_EVENT_API_THREAD_BUCKET(0)); // FIXME: traceSamplingState[0] can be 0 in split-dll build. http://crbug.com/256965 if (!traceSamplingState[0]) traceSamplingState[0] = &dummyTraceSamplingState; - traceSamplingState[1] = Platform::current()->getTraceSamplingState(1); + traceSamplingState[1] = reinterpret_cast<TraceEvent::TraceEventAPIAtomicWord*>(&TRACE_EVENT_API_THREAD_BUCKET(1)); if (!traceSamplingState[1]) traceSamplingState[1] = &dummyTraceSamplingState; - traceSamplingState[2] = Platform::current()->getTraceSamplingState(2); + traceSamplingState[2] = reinterpret_cast<TraceEvent::TraceEventAPIAtomicWord*>(&TRACE_EVENT_API_THREAD_BUCKET(2)); if (!traceSamplingState[2]) traceSamplingState[2] = &dummyTraceSamplingState; } const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* categoryName) { - static const char* dummyCategoryEnabledFlag = "*"; - // current() might not exist in unit tests. - if (!Platform::current()) - return reinterpret_cast<const unsigned char*>(dummyCategoryEnabledFlag); - - return Platform::current()->getTraceCategoryEnabledFlag(categoryName); + return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(categoryName); } TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsigned char* categoryEnabledFlag, @@ -83,10 +102,13 @@ TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign PassRefPtr<TraceEvent::ConvertableToTraceFormat> convertableValue2, unsigned flags) { - WebConvertableToTraceFormat webConvertableValues[2]; - webConvertableValues[0] = WebConvertableToTraceFormat(convertableValue1); - webConvertableValues[1] = WebConvertableToTraceFormat(convertableValue2); - return Platform::current()->addTraceEvent(phase, categoryEnabledFlag, name, id, bindId, timestamp, numArgs, argNames, argTypes, argValues, webConvertableValues, flags); + scoped_refptr<base::trace_event::ConvertableToTraceFormat> wrappers[2]; + ASSERT(numArgs <= 2); + if (numArgs >= 1 && argTypes[0] == TRACE_VALUE_TYPE_CONVERTABLE) + wrappers[0] = new ConvertableToTraceFormatWrapper(convertableValue1); + if (numArgs >= 2 && argTypes[1] == TRACE_VALUE_TYPE_CONVERTABLE) + wrappers[1] = new ConvertableToTraceFormatWrapper(convertableValue2); + return addTraceEvent(phase, categoryEnabledFlag, name, id, bindId, timestamp, numArgs, argNames, argTypes, argValues, wrappers, flags); } TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsigned char* categoryEnabledFlag, @@ -94,12 +116,26 @@ TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign int numArgs, const char** argNames, const unsigned char* argTypes, const unsigned long long* argValues, unsigned flags) { - return Platform::current()->addTraceEvent(phase, categoryEnabledFlag, name, id, bindId, timestamp, numArgs, argNames, argTypes, argValues, 0, flags); + return addTraceEvent(phase, categoryEnabledFlag, name, id, bindId, timestamp, numArgs, argNames, argTypes, argValues, nullptr, flags); +} + +TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsigned char* categoryEnabledFlag, + const char* name, unsigned long long id, unsigned long long bindId, double timestamp, + int numArgs, const char** argNames, const unsigned char* argTypes, const unsigned long long* argValues, + const scoped_refptr<base::trace_event::ConvertableToTraceFormat>* convertables, unsigned flags) +{ + base::TimeTicks timestampTimeTicks = base::TimeTicks() + base::TimeDelta::FromSecondsD(timestamp); + base::trace_event::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase, categoryEnabledFlag, name, id, bindId, base::PlatformThread::CurrentId(), timestampTimeTicks, numArgs, argNames, argTypes, argValues, convertables, flags); + TraceEvent::TraceEventHandle result; + memcpy(&result, &handle, sizeof(result)); + return result; } void EventTracer::updateTraceEventDuration(const unsigned char* categoryEnabledFlag, const char* name, TraceEvent::TraceEventHandle handle) { - Platform::current()->updateTraceEventDuration(categoryEnabledFlag, name, handle); + base::trace_event::TraceEventHandle traceEventHandle; + memcpy(&traceEventHandle, &handle, sizeof(handle)); + TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(categoryEnabledFlag, name, traceEventHandle); } double EventTracer::systemTraceTime() diff --git a/third_party/WebKit/Source/platform/EventTracer.h b/third_party/WebKit/Source/platform/EventTracer.h index e6d4b4b..4b5ec04b 100644 --- a/third_party/WebKit/Source/platform/EventTracer.h +++ b/third_party/WebKit/Source/platform/EventTracer.h @@ -31,6 +31,7 @@ #ifndef EventTracer_h #define EventTracer_h +#include "base/memory/ref_counted.h" #include "platform/PlatformExport.h" #include "wtf/Allocator.h" #include "wtf/RefCounted.h" @@ -39,6 +40,12 @@ #include <stdint.h> +namespace base { +namespace trace_event { +class ConvertableToTraceFormat; +} +} + // This will mark the trace event as disabled by default. The user will need // to explicitly enable the event. #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name @@ -91,6 +98,20 @@ public: unsigned flags); static void updateTraceEventDuration(const unsigned char* categoryEnabledFlag, const char* name, TraceEvent::TraceEventHandle); static double systemTraceTime(); + +private: + static TraceEvent::TraceEventHandle addTraceEvent(char phase, + const unsigned char* categoryEnabledFlag, + const char* name, + unsigned long long id, + unsigned long long bindId, + double timestamp, + int numArgs, + const char* argNames[], + const unsigned char argTypes[], + const unsigned long long argValues[], + const scoped_refptr<base::trace_event::ConvertableToTraceFormat>* convertables, + unsigned flags); }; } // namespace blink diff --git a/third_party/WebKit/Source/platform/blink_platform.gypi b/third_party/WebKit/Source/platform/blink_platform.gypi index 49ea34b..9dec2b0 100644 --- a/third_party/WebKit/Source/platform/blink_platform.gypi +++ b/third_party/WebKit/Source/platform/blink_platform.gypi @@ -272,7 +272,6 @@ 'exported/WebContentDecryptionModuleResult.cpp', 'exported/WebContentDecryptionModuleSession.cpp', 'exported/WebContentSettingCallbacks.cpp', - 'exported/WebConvertableToTraceFormat.cpp', 'exported/WebCredential.cpp', 'exported/WebCryptoAlgorithm.cpp', 'exported/WebCryptoKey.cpp', diff --git a/third_party/WebKit/Source/platform/exported/WebConvertableToTraceFormat.cpp b/third_party/WebKit/Source/platform/exported/WebConvertableToTraceFormat.cpp deleted file mode 100644 index dca9367..0000000 --- a/third_party/WebKit/Source/platform/exported/WebConvertableToTraceFormat.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 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. - -#include "public/platform/WebConvertableToTraceFormat.h" - -#include "platform/EventTracer.h" -#include "public/platform/WebString.h" - -namespace blink { - -WebConvertableToTraceFormat::WebConvertableToTraceFormat(PassRefPtr<TraceEvent::ConvertableToTraceFormat> convertable) - : m_private(convertable) -{ -} - -WebString WebConvertableToTraceFormat::asTraceFormat() const -{ - return m_private->asTraceFormat(); -} - -void WebConvertableToTraceFormat::assign(const WebConvertableToTraceFormat& r) -{ - m_private = r.m_private; -} - -void WebConvertableToTraceFormat::moveFrom(WebConvertableToTraceFormat& r) -{ - m_private.moveFrom(r.m_private); -} - -void WebConvertableToTraceFormat::reset() -{ - m_private.reset(); -} - -} // namespace blink diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp index 928e88c..94c2e7c 100644 --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.cpp @@ -89,12 +89,6 @@ WebDiscardableMemory* TestingPlatformSupport::allocateAndLockDiscardableMemory(s return !m_config.hasDiscardableMemorySupport ? 0 : new TestingDiscardableMemory(bytes); } -const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const char* categoryName) -{ - static const unsigned char tracingIsDisabled = 0; - return &tracingIsDisabled; -} - WebString TestingPlatformSupport::defaultLocale() { return WebString::fromUTF8("en-US"); diff --git a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h index 027ed1d..fcaec86 100644 --- a/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h +++ b/third_party/WebKit/Source/platform/testing/TestingPlatformSupport.h @@ -114,7 +114,6 @@ public: // Platform: WebDiscardableMemory* allocateAndLockDiscardableMemory(size_t bytes) override; - const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) override; WebString defaultLocale() override; WebCompositorSupport* compositorSupport() override; WebThread* currentThread() override; diff --git a/third_party/WebKit/public/blink_headers.gypi b/third_party/WebKit/public/blink_headers.gypi index fcb9d72..62f4b60 100644 --- a/third_party/WebKit/public/blink_headers.gypi +++ b/third_party/WebKit/public/blink_headers.gypi @@ -44,7 +44,6 @@ "platform/WebContentLayer.h", "platform/WebContentLayerClient.h", "platform/WebContentSettingCallbacks.h", - "platform/WebConvertableToTraceFormat.h", "platform/WebCookieJar.h", "platform/WebCredential.h", "platform/WebCredentialManagerClient.h", diff --git a/third_party/WebKit/public/platform/Platform.h b/third_party/WebKit/public/platform/Platform.h index 166d149..bed866e 100644 --- a/third_party/WebKit/public/platform/Platform.h +++ b/third_party/WebKit/public/platform/Platform.h @@ -64,7 +64,6 @@ class WebBlobRegistry; class WebCanvasCaptureHandler; class WebClipboard; class WebCompositorSupport; -class WebConvertableToTraceFormat; class WebCookieJar; class WebCrypto; class WebDatabaseObserver; @@ -446,107 +445,6 @@ public: // Get a pointer to testing support interfaces. Will not be available in production builds. virtual WebUnitTestSupport* unitTestSupport() { return nullptr; } - - // Tracing ------------------------------------------------------------- - - // Get a pointer to the enabled state of the given trace category. The - // embedder can dynamically change the enabled state as trace event - // recording is started and stopped by the application. Only long-lived - // literal strings should be given as the category name. The implementation - // expects the returned pointer to be held permanently in a local static. If - // the unsigned char is non-zero, tracing is enabled. If tracing is enabled, - // addTraceEvent is expected to be called by the trace event macros. - virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) { return nullptr; } - - typedef intptr_t TraceEventAPIAtomicWord; - - // Get a pointer to a global state of the given thread. An embedder is - // expected to update the global state as the state of the embedder changes. - // A sampling thread in the Chromium side reads the global state periodically - // and reflects the sampling profiled results into about:tracing. - virtual TraceEventAPIAtomicWord* getTraceSamplingState(const unsigned bucketName) { return nullptr; } - - typedef uint64_t TraceEventHandle; - - // Add a trace event to the platform tracing system. Depending on the actual - // enabled state, this event may be recorded or dropped. - // - phase specifies the type of event: - // - BEGIN ('B'): Marks the beginning of a scoped event. - // - END ('E'): Marks the end of a scoped event. - // - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't - // need a matching END event. Instead, at the end of the scope, - // updateTraceEventDuration() must be called with the TraceEventHandle - // returned from addTraceEvent(). - // - INSTANT ('I'): Standalone, instantaneous event. - // - START ('S'): Marks the beginning of an asynchronous event (the end - // event can occur in a different scope or thread). The id parameter is - // used to match START/FINISH pairs. - // - FINISH ('F'): Marks the end of an asynchronous event. - // - COUNTER ('C'): Used to trace integer quantities that change over - // time. The argument values are expected to be of type int. - // - METADATA ('M'): Reserved for internal use. - // - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag. - // - name is the name of the event. Also used to match BEGIN/END and - // START/FINISH pairs. - // - id optionally allows events of the same name to be distinguished from - // each other. For example, to trace the consutruction and destruction of - // objects, specify the pointer as the id parameter. - // - numArgs specifies the number of elements in argNames, argTypes, and - // argValues. - // - argNames is the array of argument names. Use long-lived literal strings - // or specify the COPY flag. - // - argTypes is the array of argument types: - // - BOOL (1): bool - // - UINT (2): unsigned long long - // - INT (3): long long - // - DOUBLE (4): double - // - POINTER (5): void* - // - STRING (6): char* (long-lived null-terminated char* string) - // - COPY_STRING (7): char* (temporary null-terminated char* string) - // - CONVERTABLE (8): WebConvertableToTraceFormat - // - argValues is the array of argument values. Each value is the unsigned - // long long member of a union of all supported types. - // - convertableValues is the array of WebConvertableToTraceFormat classes - // that may be converted to trace format by calling asTraceFormat method. - // ConvertableToTraceFormat interface. - // convertableValues can be moved to another object by - // WebConvertableToTraceFormat::moveFrom() in addTraceEvent(), and thus - // should not be dereferenced (e.g. asTraceFormat() should not be called) - // after return from addTraceEvent(). - // - thresholdBeginId optionally specifies the value returned by a previous - // call to addTraceEvent with a BEGIN phase. - // - threshold is used on an END phase event in conjunction with the - // thresholdBeginId of a prior BEGIN event. The threshold is the minimum - // number of microseconds that must have passed since the BEGIN event. If - // less than threshold microseconds has passed, the BEGIN/END pair is - // dropped. - // - flags can be 0 or one or more of the following, ORed together: - // - COPY (0x1): treat all strings (name, argNames and argValues of type - // string) as temporary so that they will be copied by addTraceEvent. - // - HAS_ID (0x2): use the id argument to uniquely identify the event for - // matching with other events of the same name. - // - MANGLE_ID (0x4): specify this flag if the id parameter is the value - // of a pointer. - virtual TraceEventHandle addTraceEvent( - char phase, - const unsigned char* categoryEnabledFlag, - const char* name, - unsigned long long id, - unsigned long long bindId, - double timestamp, - int numArgs, - const char** argNames, - const unsigned char* argTypes, - const unsigned long long* argValues, - WebConvertableToTraceFormat* convertableValues, - unsigned flags) - { - return 0; - } - - // Set the duration field of a COMPLETE trace event. - virtual void updateTraceEventDuration(const unsigned char* categoryEnabledFlag, const char* name, TraceEventHandle) { } - // Callbacks for reporting histogram data. // CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do. virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) { } diff --git a/third_party/WebKit/public/platform/WebConvertableToTraceFormat.h b/third_party/WebKit/public/platform/WebConvertableToTraceFormat.h deleted file mode 100644 index aaffa05..0000000 --- a/third_party/WebKit/public/platform/WebConvertableToTraceFormat.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 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. - -#ifndef WebConvertableToTraceFormat_h -#define WebConvertableToTraceFormat_h - -#include "WebPrivatePtr.h" -#include "WebString.h" - -namespace blink { - -namespace TraceEvent { -class ConvertableToTraceFormat; -} - -class WebConvertableToTraceFormat { -public: - WebConvertableToTraceFormat() { } -#if INSIDE_BLINK - WebConvertableToTraceFormat(PassRefPtr<TraceEvent::ConvertableToTraceFormat>); -#endif - ~WebConvertableToTraceFormat() { reset(); } - - BLINK_PLATFORM_EXPORT WebString asTraceFormat() const; - BLINK_PLATFORM_EXPORT void assign(const WebConvertableToTraceFormat&); - BLINK_PLATFORM_EXPORT void moveFrom(WebConvertableToTraceFormat&); - BLINK_PLATFORM_EXPORT void reset(); - - WebConvertableToTraceFormat(const WebConvertableToTraceFormat& r) { assign(r); } - WebConvertableToTraceFormat& operator=(const WebConvertableToTraceFormat& r) - { - assign(r); - return *this; - } - -private: - WebPrivatePtr<TraceEvent::ConvertableToTraceFormat> m_private; -}; - -} // namespace blink - -#endif |