Gigacage: enable only for WebContent process and token executables
[WebKit-https.git] / Source / bmalloc / bmalloc / Gigacage.cpp
index 8a5394f..0090699 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
 #include "CryptoRandom.h"
 #include "Environment.h"
 #include "PerProcess.h"
+#include "ProcessCheck.h"
 #include "VMAllocate.h"
 #include "Vector.h"
 #include "bmalloc.h"
@@ -250,6 +251,9 @@ bool shouldBeEnabled()
     std::call_once(
         onceFlag,
         [] {
+            if (!gigacageEnabledForProcess())
+                return;
+
             bool result = !PerProcess<Environment>::get()->isDebugHeapEnabled();
             if (!result)
                 return;