Commit cae09d5b authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Add Location information ScopedBlockingCall trace events

This CL is adding the missing constuctors receiving the Location
information to ScopedBlockingCall. The location information is added
to the trace event with the same format than the top-level run tasks
events.

The ScopedBlockingCall constructors will be moved to the new
constructor with the Location in the following CLs.

R=gab@chromium.org

Bug: 934302
Change-Id: I6247a1ae099c45ebe9454cd74e9953a2add6e70f
Reviewed-on: https://chromium-review.googlesource.com/c/1479846Reviewed-by: default avataroysteine <oysteine@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634741}
parent fd511299
...@@ -66,6 +66,10 @@ UncheckedScopedBlockingCall::~UncheckedScopedBlockingCall() { ...@@ -66,6 +66,10 @@ UncheckedScopedBlockingCall::~UncheckedScopedBlockingCall() {
} // namespace internal } // namespace internal
ScopedBlockingCall::ScopedBlockingCall(BlockingType blocking_type) ScopedBlockingCall::ScopedBlockingCall(BlockingType blocking_type)
: ScopedBlockingCall(FROM_HERE, blocking_type) {}
ScopedBlockingCall::ScopedBlockingCall(const Location& from_here,
BlockingType blocking_type)
: UncheckedScopedBlockingCall(blocking_type) { : UncheckedScopedBlockingCall(blocking_type) {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
DCHECK(!tls_construction_in_progress.Get().Get()); DCHECK(!tls_construction_in_progress.Get().Get());
...@@ -73,9 +77,9 @@ ScopedBlockingCall::ScopedBlockingCall(BlockingType blocking_type) ...@@ -73,9 +77,9 @@ ScopedBlockingCall::ScopedBlockingCall(BlockingType blocking_type)
#endif #endif
internal::AssertBlockingAllowed(); internal::AssertBlockingAllowed();
TRACE_EVENT_BEGIN1("base", "ScopedBlockingCall", "blocking_type", TRACE_EVENT_BEGIN2("base", "ScopedBlockingCall", "file_name",
static_cast<int>(blocking_type)); from_here.file_name(), "function_name",
from_here.function_name());
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
tls_construction_in_progress.Get().Set(false); tls_construction_in_progress.Get().Set(false);
#endif #endif
...@@ -89,6 +93,11 @@ namespace internal { ...@@ -89,6 +93,11 @@ namespace internal {
ScopedBlockingCallWithBaseSyncPrimitives:: ScopedBlockingCallWithBaseSyncPrimitives::
ScopedBlockingCallWithBaseSyncPrimitives(BlockingType blocking_type) ScopedBlockingCallWithBaseSyncPrimitives(BlockingType blocking_type)
: ScopedBlockingCallWithBaseSyncPrimitives(FROM_HERE, blocking_type) {}
ScopedBlockingCallWithBaseSyncPrimitives::
ScopedBlockingCallWithBaseSyncPrimitives(const Location& from_here,
BlockingType blocking_type)
: UncheckedScopedBlockingCall(blocking_type) { : UncheckedScopedBlockingCall(blocking_type) {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
DCHECK(!tls_construction_in_progress.Get().Get()); DCHECK(!tls_construction_in_progress.Get().Get());
...@@ -96,8 +105,9 @@ ScopedBlockingCallWithBaseSyncPrimitives:: ...@@ -96,8 +105,9 @@ ScopedBlockingCallWithBaseSyncPrimitives::
#endif #endif
internal::AssertBaseSyncPrimitivesAllowed(); internal::AssertBaseSyncPrimitivesAllowed();
TRACE_EVENT_BEGIN1("base", "ScopedBlockingCallWithBaseSyncPrimitives", TRACE_EVENT_BEGIN2("base", "ScopedBlockingCallWithBaseSyncPrimitives",
"blocking_type", static_cast<int>(blocking_type)); "file_name", from_here.file_name(), "function_name",
from_here.function_name());
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
tls_construction_in_progress.Get().Set(false); tls_construction_in_progress.Get().Set(false);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define BASE_THREADING_SCOPED_BLOCKING_CALL_H #define BASE_THREADING_SCOPED_BLOCKING_CALL_H
#include "base/base_export.h" #include "base/base_export.h"
#include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
namespace base { namespace base {
...@@ -34,7 +35,7 @@ class BlockingObserver; ...@@ -34,7 +35,7 @@ class BlockingObserver;
// ScopedBlockingCallWithBaseSyncPrimitives without assertions. // ScopedBlockingCallWithBaseSyncPrimitives without assertions.
class BASE_EXPORT UncheckedScopedBlockingCall { class BASE_EXPORT UncheckedScopedBlockingCall {
public: public:
UncheckedScopedBlockingCall(BlockingType blocking_type); explicit UncheckedScopedBlockingCall(BlockingType blocking_type);
~UncheckedScopedBlockingCall(); ~UncheckedScopedBlockingCall();
private: private:
...@@ -109,7 +110,8 @@ class BASE_EXPORT UncheckedScopedBlockingCall { ...@@ -109,7 +110,8 @@ class BASE_EXPORT UncheckedScopedBlockingCall {
class BASE_EXPORT ScopedBlockingCall class BASE_EXPORT ScopedBlockingCall
: public internal::UncheckedScopedBlockingCall { : public internal::UncheckedScopedBlockingCall {
public: public:
ScopedBlockingCall(BlockingType blocking_type); explicit ScopedBlockingCall(BlockingType blocking_type);
ScopedBlockingCall(const Location& from_here, BlockingType blocking_type);
~ScopedBlockingCall(); ~ScopedBlockingCall();
}; };
...@@ -123,7 +125,9 @@ namespace internal { ...@@ -123,7 +125,9 @@ namespace internal {
class BASE_EXPORT ScopedBlockingCallWithBaseSyncPrimitives class BASE_EXPORT ScopedBlockingCallWithBaseSyncPrimitives
: public UncheckedScopedBlockingCall { : public UncheckedScopedBlockingCall {
public: public:
ScopedBlockingCallWithBaseSyncPrimitives(BlockingType blocking_type); explicit ScopedBlockingCallWithBaseSyncPrimitives(BlockingType blocking_type);
ScopedBlockingCallWithBaseSyncPrimitives(const Location& from_here,
BlockingType blocking_type);
~ScopedBlockingCallWithBaseSyncPrimitives(); ~ScopedBlockingCallWithBaseSyncPrimitives();
}; };
......
...@@ -18,7 +18,8 @@ struct WhitelistEntry { ...@@ -18,7 +18,8 @@ struct WhitelistEntry {
const char* const* arg_name_filter; const char* const* arg_name_filter;
}; };
const char* const kBaseAllowedArgs[] = {"blocking_type", nullptr}; const char* const kScopedBlockingCallAllowedArgs[] = {"file_name",
"function_name", nullptr};
const char* const kGPUAllowedArgs[] = {nullptr}; const char* const kGPUAllowedArgs[] = {nullptr};
const char* const kInputLatencyAllowedArgs[] = {"data", nullptr}; const char* const kInputLatencyAllowedArgs[] = {"data", nullptr};
const char* const kMemoryDumpAllowedArgs[] = {"dumps", nullptr}; const char* const kMemoryDumpAllowedArgs[] = {"dumps", nullptr};
...@@ -35,7 +36,7 @@ const WhitelistEntry kEventArgsWhitelist[] = { ...@@ -35,7 +36,7 @@ const WhitelistEntry kEventArgsWhitelist[] = {
{"__metadata", "chrome_library_module", nullptr}, {"__metadata", "chrome_library_module", nullptr},
{"__metadata", "stackFrames", nullptr}, {"__metadata", "stackFrames", nullptr},
{"__metadata", "typeNames", nullptr}, {"__metadata", "typeNames", nullptr},
{"base", "*", kBaseAllowedArgs}, {"base", "ScopedBlockingCall*", kScopedBlockingCallAllowedArgs},
{"browser", "KeyedServiceFactory::GetServiceForContext", nullptr}, {"browser", "KeyedServiceFactory::GetServiceForContext", nullptr},
{"GPU", "*", kGPUAllowedArgs}, {"GPU", "*", kGPUAllowedArgs},
{"ipc", "GpuChannelHost::Send", nullptr}, {"ipc", "GpuChannelHost::Send", nullptr},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment