Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 #include "core/loader/FrameLoader.h" | 54 #include "core/loader/FrameLoader.h" |
| 55 #include "core/loader/FrameLoaderClient.h" | 55 #include "core/loader/FrameLoaderClient.h" |
| 56 #include "platform/Histogram.h" | 56 #include "platform/Histogram.h" |
| 57 #include "platform/RuntimeEnabledFeatures.h" | 57 #include "platform/RuntimeEnabledFeatures.h" |
| 58 #include "platform/ScriptForbiddenScope.h" | 58 #include "platform/ScriptForbiddenScope.h" |
| 59 #include "platform/TraceEvent.h" | 59 #include "platform/TraceEvent.h" |
| 60 #include "platform/heap/Handle.h" | 60 #include "platform/heap/Handle.h" |
| 61 #include "platform/weborigin/SecurityOrigin.h" | 61 #include "platform/weborigin/SecurityOrigin.h" |
| 62 #include "public/platform/Platform.h" | 62 #include "public/platform/Platform.h" |
| 63 #include "wtf/Assertions.h" | 63 #include "wtf/Assertions.h" |
| 64 #include "wtf/CurrentTime.h" | |
| 64 #include "wtf/OwnPtr.h" | 65 #include "wtf/OwnPtr.h" |
| 65 #include "wtf/StringExtras.h" | 66 #include "wtf/StringExtras.h" |
| 66 #include "wtf/text/CString.h" | 67 #include "wtf/text/CString.h" |
| 67 #include <algorithm> | 68 #include <algorithm> |
| 68 #include <utility> | 69 #include <utility> |
| 69 #include <v8-debug.h> | 70 #include <v8-debug.h> |
| 70 #include <v8.h> | 71 #include <v8.h> |
| 71 | 72 |
| 72 namespace blink { | 73 namespace blink { |
| 73 | 74 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 if (isContextInitialized()) | 219 if (isContextInitialized()) |
| 219 return true; | 220 return true; |
| 220 | 221 |
| 221 return initialize(); | 222 return initialize(); |
| 222 } | 223 } |
| 223 | 224 |
| 224 bool WindowProxy::initialize() | 225 bool WindowProxy::initialize() |
| 225 { | 226 { |
| 226 TRACE_EVENT0("v8", "WindowProxy::initialize"); | 227 TRACE_EVENT0("v8", "WindowProxy::initialize"); |
| 227 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "InitializeWindow"); | 228 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "InitializeWindow"); |
| 229 double startTime = currentTimeMS(); | |
|
kouhei (in TOK)
2016/05/24 09:08:12
use monotonicallyIncreasingTime() instead of curre
peria
2016/05/24 09:36:24
Oh, I misunderstood the last argument of CustomCou
| |
| 228 | 230 |
| 229 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 231 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 230 | 232 |
| 231 v8::HandleScope handleScope(m_isolate); | 233 v8::HandleScope handleScope(m_isolate); |
| 232 | 234 |
| 233 createContext(); | 235 createContext(); |
| 234 | 236 |
| 235 if (!isContextInitialized()) | 237 if (!isContextInitialized()) |
| 236 return false; | 238 return false; |
| 237 | 239 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 262 } else { | 264 } else { |
| 263 updateActivityLogger(); | 265 updateActivityLogger(); |
| 264 origin = m_world->isolatedWorldSecurityOrigin(); | 266 origin = m_world->isolatedWorldSecurityOrigin(); |
| 265 setSecurityToken(origin); | 267 setSecurityToken(origin); |
| 266 } | 268 } |
| 267 if (m_frame->isLocalFrame()) { | 269 if (m_frame->isLocalFrame()) { |
| 268 LocalFrame* frame = toLocalFrame(m_frame); | 270 LocalFrame* frame = toLocalFrame(m_frame); |
| 269 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), fram e, origin); | 271 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), fram e, origin); |
| 270 frame->loader().client()->didCreateScriptContext(context, m_world->exten sionGroup(), m_world->worldId()); | 272 frame->loader().client()->didCreateScriptContext(context, m_world->exten sionGroup(), m_world->worldId()); |
| 271 } | 273 } |
| 274 | |
| 275 double endTime = currentTimeMS(); | |
| 276 DEFINE_STATIC_LOCAL(CustomCountHistogram, initializeHistogram, ("Blink.Bindi ng.InitializeWindowProxy", 0, 200, 5)); | |
| 277 initializeHistogram.count(endTime - startTime); | |
| 272 return true; | 278 return true; |
| 273 } | 279 } |
| 274 | 280 |
| 275 void WindowProxy::createContext() | 281 void WindowProxy::createContext() |
| 276 { | 282 { |
| 277 // FIXME: This should be a null check of m_frame->client(), but there are st ill some edge cases | 283 // FIXME: This should be a null check of m_frame->client(), but there are st ill some edge cases |
| 278 // that this fails to catch during frame detach. | 284 // that this fails to catch during frame detach. |
| 279 if (m_frame->isLocalFrame() && !toLocalFrame(m_frame)->loader().documentLoad er()) | 285 if (m_frame->isLocalFrame() && !toLocalFrame(m_frame)->loader().documentLoad er()) |
| 280 return; | 286 return; |
| 281 | 287 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 } | 558 } |
| 553 | 559 |
| 554 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 560 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
| 555 { | 561 { |
| 556 if (!isContextInitialized()) | 562 if (!isContextInitialized()) |
| 557 return; | 563 return; |
| 558 setSecurityToken(origin); | 564 setSecurityToken(origin); |
| 559 } | 565 } |
| 560 | 566 |
| 561 } // namespace blink | 567 } // namespace blink |
| OLD | NEW |