Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 #include "wtf/ThreadingPrimitives.h" | 52 #include "wtf/ThreadingPrimitives.h" |
| 53 #include "wtf/text/StringBuilder.h" | 53 #include "wtf/text/StringBuilder.h" |
| 54 | 54 |
| 55 namespace blink { | 55 namespace blink { |
| 56 | 56 |
| 57 static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Local<v8::Context> con text) | 57 static LocalFrame* retrieveFrameWithGlobalObjectCheck(v8::Local<v8::Context> con text) |
| 58 { | 58 { |
| 59 return toLocalFrame(toFrameIfNotDetached(context)); | 59 return toLocalFrame(toFrameIfNotDetached(context)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // TODO(Oilpan): avoid keeping a raw reference separate from the | |
| 63 // owner one; does not enable heap-movable objects. | |
| 62 PageScriptDebugServer* PageScriptDebugServer::s_instance = nullptr; | 64 PageScriptDebugServer* PageScriptDebugServer::s_instance = nullptr; |
|
haraken
2015/05/09 14:37:28
This looks nasty, not only in oilpan but also in n
| |
| 63 | 65 |
| 64 PageScriptDebugServer::PageScriptDebugServer(PassOwnPtr<ClientMessageLoop> clien tMessageLoop, v8::Isolate* isolate) | 66 PageScriptDebugServer::PageScriptDebugServer(PassOwnPtr<ClientMessageLoop> clien tMessageLoop, v8::Isolate* isolate) |
| 65 : PerIsolateDebuggerClient(isolate, adoptPtr(new ScriptDebugServer(isolate, this))) | 67 : PerIsolateDebuggerClient(isolate, ScriptDebugServer::create(isolate, this) ) |
| 66 , m_clientMessageLoop(clientMessageLoop) | 68 , m_clientMessageLoop(clientMessageLoop) |
| 67 , m_pausedFrame(nullptr) | 69 , m_pausedFrame(nullptr) |
| 68 { | 70 { |
| 69 MutexLocker locker(creationMutex()); | 71 MutexLocker locker(creationMutex()); |
| 70 ASSERT(!s_instance); | 72 ASSERT(!s_instance); |
| 71 s_instance = this; | 73 s_instance = this; |
| 72 } | 74 } |
| 73 | 75 |
| 74 PageScriptDebugServer::~PageScriptDebugServer() | 76 PageScriptDebugServer::~PageScriptDebugServer() |
| 75 { | 77 { |
| 76 MutexLocker locker(creationMutex()); | 78 MutexLocker locker(creationMutex()); |
| 77 ASSERT(s_instance == this); | 79 ASSERT(s_instance == this); |
| 78 s_instance = nullptr; | 80 s_instance = nullptr; |
| 79 } | 81 } |
| 80 | 82 |
| 81 Mutex& PageScriptDebugServer::creationMutex() | 83 Mutex& PageScriptDebugServer::creationMutex() |
| 82 { | 84 { |
| 83 AtomicallyInitializedStaticReference(Mutex, mutex, (new Mutex)); | 85 AtomicallyInitializedStaticReference(Mutex, mutex, (new Mutex)); |
| 84 return mutex; | 86 return mutex; |
| 85 } | 87 } |
| 86 | 88 |
| 89 DEFINE_TRACE(PageScriptDebugServer) | |
| 90 { | |
| 91 #if ENABLE(OILPAN) | |
| 92 visitor->trace(m_pausedFrame); | |
| 93 visitor->trace(m_listenersMap); | |
| 94 #endif | |
| 95 PerIsolateDebuggerClient::trace(visitor); | |
| 96 } | |
| 97 | |
| 87 void PageScriptDebugServer::setContextDebugData(v8::Local<v8::Context> context, const String& type, int contextDebugId) | 98 void PageScriptDebugServer::setContextDebugData(v8::Local<v8::Context> context, const String& type, int contextDebugId) |
| 88 { | 99 { |
| 89 String debugData = "[" + type + "," + String::number(contextDebugId) + "]"; | 100 String debugData = "[" + type + "," + String::number(contextDebugId) + "]"; |
| 90 ScriptDebugServer::setContextDebugData(context, debugData); | 101 ScriptDebugServer::setContextDebugData(context, debugData); |
| 91 } | 102 } |
| 92 | 103 |
| 93 void PageScriptDebugServer::addListener(ScriptDebugListener* listener, LocalFram e* localFrameRoot, int contextDebugId) | 104 void PageScriptDebugServer::addListener(ScriptDebugListener* listener, LocalFram e* localFrameRoot, int contextDebugId) |
| 94 { | 105 { |
| 95 ASSERT(localFrameRoot == localFrameRoot->localFrameRoot()); | 106 ASSERT(localFrameRoot == localFrameRoot->localFrameRoot()); |
| 96 | 107 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 | 167 |
| 157 m_pausedFrame = 0; | 168 m_pausedFrame = 0; |
| 158 } | 169 } |
| 159 | 170 |
| 160 void PageScriptDebugServer::quitMessageLoopOnPause() | 171 void PageScriptDebugServer::quitMessageLoopOnPause() |
| 161 { | 172 { |
| 162 m_clientMessageLoop->quitNow(); | 173 m_clientMessageLoop->quitNow(); |
| 163 } | 174 } |
| 164 | 175 |
| 165 } // namespace blink | 176 } // namespace blink |
| OLD | NEW |