Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Unified Diff: third_party/WebKit/Source/core/inspector/IdentifiersFactory.cpp

Issue 2011983003: DevTools: fix crash upon non-initialized IdentifiersFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/IdentifiersFactory.cpp
diff --git a/third_party/WebKit/Source/core/inspector/IdentifiersFactory.cpp b/third_party/WebKit/Source/core/inspector/IdentifiersFactory.cpp
index dc752ebd8d3d29261ae6d71318f9b99a5f3fdeb4..5482e92ca76be424f6a670383041b077d9a05008 100644
--- a/third_party/WebKit/Source/core/inspector/IdentifiersFactory.cpp
+++ b/third_party/WebKit/Source/core/inspector/IdentifiersFactory.cpp
@@ -29,6 +29,7 @@
#include "core/frame/LocalFrame.h"
#include "core/inspector/InspectedFrames.h"
#include "core/loader/DocumentLoader.h"
+#include "public/platform/Platform.h"
#include "wtf/Assertions.h"
#include "wtf/text/StringBuilder.h"
@@ -49,10 +50,11 @@ String& processIdPrefix()
// static
-void IdentifiersFactory::setProcessId(long processId)
+void IdentifiersFactory::initialize()
{
StringBuilder builder;
- builder.appendNumber(processId);
+
+ builder.appendNumber(Platform::current()->getUniqueIdForProcess());
builder.append('.');
ASSERT(processIdPrefix().isEmpty() || processIdPrefix() == builder.toString());
processIdPrefix() = builder.toString();
@@ -108,7 +110,8 @@ DocumentLoader* IdentifiersFactory::loaderById(InspectedFrames* inspectedFrames,
// static
String IdentifiersFactory::addProcessIdPrefixTo(int id)
{
- ASSERT(!processIdPrefix().isEmpty());
+ if (processIdPrefix().isEmpty())
+ initialize();
return processIdPrefix() + String::number(id);
}

Powered by Google App Engine
This is Rietveld 408576698