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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp

Issue 1979963002: Remove OwnPtr::release() calls in platform/ (part inspector). (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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 { 734 {
735 V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(m_isolate->GetCurrentC ontext()); 735 V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(m_isolate->GetCurrentC ontext());
736 return V8StackTraceImpl::create(agent, stackTrace, maxStackSize); 736 return V8StackTraceImpl::create(agent, stackTrace, maxStackSize);
737 } 737 }
738 738
739 PassOwnPtr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId) 739 PassOwnPtr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId)
740 { 740 {
741 ASSERT(!m_sessions.contains(contextGroupId)); 741 ASSERT(!m_sessions.contains(contextGroupId));
742 OwnPtr<V8InspectorSessionImpl> session = V8InspectorSessionImpl::create(this , contextGroupId); 742 OwnPtr<V8InspectorSessionImpl> session = V8InspectorSessionImpl::create(this , contextGroupId);
743 m_sessions.set(contextGroupId, session.get()); 743 m_sessions.set(contextGroupId, session.get());
744 return session.release(); 744 return std::move(session);
745 } 745 }
746 746
747 void V8DebuggerImpl::disconnect(V8InspectorSessionImpl* session) 747 void V8DebuggerImpl::disconnect(V8InspectorSessionImpl* session)
748 { 748 {
749 ASSERT(m_sessions.contains(session->contextGroupId())); 749 ASSERT(m_sessions.contains(session->contextGroupId()));
750 m_sessions.remove(session->contextGroupId()); 750 m_sessions.remove(session->contextGroupId());
751 } 751 }
752 752
753 void V8DebuggerImpl::contextCreated(const V8ContextInfo& info) 753 void V8DebuggerImpl::contextCreated(const V8ContextInfo& info)
754 { 754 {
755 ASSERT(info.context->GetIsolate() == m_isolate); 755 ASSERT(info.context->GetIsolate() == m_isolate);
756 // TODO(dgozman): make s_lastContextId non-static. 756 // TODO(dgozman): make s_lastContextId non-static.
757 int contextId = atomicIncrement(&s_lastContextId); 757 int contextId = atomicIncrement(&s_lastContextId);
758 String16 debugData = String16::number(info.contextGroupId) + "," + String16: :number(contextId) + "," + (info.isDefault ? "default" : "nondefault"); 758 String16 debugData = String16::number(info.contextGroupId) + "," + String16: :number(contextId) + "," + (info.isDefault ? "default" : "nondefault");
759 v8::HandleScope scope(m_isolate); 759 v8::HandleScope scope(m_isolate);
760 v8::Context::Scope contextScope(info.context); 760 v8::Context::Scope contextScope(info.context);
761 info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), toV8String(m_isolate, debugData)); 761 info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), toV8String(m_isolate, debugData));
762 762
763 if (!m_contexts.contains(info.contextGroupId)) 763 if (!m_contexts.contains(info.contextGroupId))
764 m_contexts.set(info.contextGroupId, adoptPtr(new ContextByIdMap())); 764 m_contexts.set(info.contextGroupId, adoptPtr(new ContextByIdMap()));
765 ASSERT(!m_contexts.get(info.contextGroupId)->contains(contextId)); 765 ASSERT(!m_contexts.get(info.contextGroupId)->contains(contextId));
766 766
767 OwnPtr<InspectedContext> contextOwner = adoptPtr(new InspectedContext(this, info, contextId)); 767 OwnPtr<InspectedContext> contextOwner = adoptPtr(new InspectedContext(this, info, contextId));
768 InspectedContext* inspectedContext = contextOwner.get(); 768 InspectedContext* inspectedContext = contextOwner.get();
769 m_contexts.get(info.contextGroupId)->set(contextId, contextOwner.release()); 769 m_contexts.get(info.contextGroupId)->set(contextId, std::move(contextOwner)) ;
770 770
771 if (V8InspectorSessionImpl* session = m_sessions.get(info.contextGroupId)) 771 if (V8InspectorSessionImpl* session = m_sessions.get(info.contextGroupId))
772 session->runtimeAgentImpl()->reportExecutionContextCreated(inspectedCont ext); 772 session->runtimeAgentImpl()->reportExecutionContextCreated(inspectedCont ext);
773 } 773 }
774 774
775 void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context) 775 void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context)
776 { 776 {
777 int contextId = V8Debugger::contextId(context); 777 int contextId = V8Debugger::contextId(context);
778 int contextGroupId = getGroupId(context); 778 int contextGroupId = getGroupId(context);
779 if (!m_contexts.contains(contextGroupId) || !m_contexts.get(contextGroupId)- >contains(contextId)) 779 if (!m_contexts.contains(contextGroupId) || !m_contexts.get(contextGroupId)- >contains(contextId))
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 return nullptr; 845 return nullptr;
846 return m_contexts.get(contextGroupId); 846 return m_contexts.get(contextGroupId);
847 } 847 }
848 848
849 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d) 849 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d)
850 { 850 {
851 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; 851 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr;
852 } 852 }
853 853
854 } // namespace blink 854 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698