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

Side by Side Diff: Source/bindings/v8/SerializedScriptValue.cpp

Issue 23788005: Remove calls to HandleScope default ctor. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: code review (pfeldman) Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptString.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 , m_arrayBuffers(arrayBufferContents ? arrayBufferContents->size() : 0) 1978 , m_arrayBuffers(arrayBufferContents ? arrayBufferContents->size() : 0)
1979 , m_version(0) 1979 , m_version(0)
1980 { 1980 {
1981 } 1981 }
1982 1982
1983 v8::Handle<v8::Value> deserialize() 1983 v8::Handle<v8::Value> deserialize()
1984 { 1984 {
1985 if (!m_reader.readVersion(m_version) || m_version > wireFormatVersion) 1985 if (!m_reader.readVersion(m_version) || m_version > wireFormatVersion)
1986 return v8NullWithCheck(m_reader.getIsolate()); 1986 return v8NullWithCheck(m_reader.getIsolate());
1987 m_reader.setVersion(m_version); 1987 m_reader.setVersion(m_version);
1988 v8::HandleScope scope; 1988 v8::HandleScope scope(m_reader.getIsolate());
1989 while (!m_reader.isEof()) { 1989 while (!m_reader.isEof()) {
1990 if (!doDeserialize()) 1990 if (!doDeserialize())
1991 return v8NullWithCheck(m_reader.getIsolate()); 1991 return v8NullWithCheck(m_reader.getIsolate());
1992 } 1992 }
1993 if (stackDepth() != 1 || m_openCompositeReferenceStack.size()) 1993 if (stackDepth() != 1 || m_openCompositeReferenceStack.size())
1994 return v8NullWithCheck(m_reader.getIsolate()); 1994 return v8NullWithCheck(m_reader.getIsolate());
1995 v8::Handle<v8::Value> result = scope.Close(element(0)); 1995 v8::Handle<v8::Value> result = scope.Close(element(0));
1996 return result; 1996 return result;
1997 } 1997 }
1998 1998
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2500 Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.g et()); 2500 Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.g et());
2501 2501
2502 // deserialize() can run arbitrary script (e.g., setters), which could resul t in |this| being destroyed. 2502 // deserialize() can run arbitrary script (e.g., setters), which could resul t in |this| being destroyed.
2503 // Holding a RefPtr ensures we are alive (along with our internal data) thro ughout the operation. 2503 // Holding a RefPtr ensures we are alive (along with our internal data) thro ughout the operation.
2504 RefPtr<SerializedScriptValue> protect(this); 2504 RefPtr<SerializedScriptValue> protect(this);
2505 return deserializer.deserialize(); 2505 return deserializer.deserialize();
2506 } 2506 }
2507 2507
2508 ScriptValue SerializedScriptValue::deserializeForInspector(ScriptState* scriptSt ate) 2508 ScriptValue SerializedScriptValue::deserializeForInspector(ScriptState* scriptSt ate)
2509 { 2509 {
2510 v8::HandleScope handleScope; 2510 v8::HandleScope handleScope(scriptState->isolate());
2511 v8::Context::Scope contextScope(scriptState->context()); 2511 v8::Context::Scope contextScope(scriptState->context());
2512 2512
2513 return ScriptValue(deserialize(scriptState->isolate())); 2513 return ScriptValue(deserialize(scriptState->isolate()));
2514 } 2514 }
2515 2515
2516 void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext() 2516 void SerializedScriptValue::registerMemoryAllocatedWithCurrentScriptContext()
2517 { 2517 {
2518 if (m_externallyAllocatedMemory) 2518 if (m_externallyAllocatedMemory)
2519 return; 2519 return;
2520 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length()); 2520 m_externallyAllocatedMemory = static_cast<intptr_t>(m_data.length());
(...skipping 10 matching lines...) Expand all
2531 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemo ry); 2531 v8::V8::AdjustAmountOfExternalAllocatedMemory(-m_externallyAllocatedMemo ry);
2532 } 2532 }
2533 } 2533 }
2534 2534
2535 uint32_t SerializedScriptValue::wireFormatVersion() 2535 uint32_t SerializedScriptValue::wireFormatVersion()
2536 { 2536 {
2537 return WebCore::wireFormatVersion; 2537 return WebCore::wireFormatVersion;
2538 } 2538 }
2539 2539
2540 } // namespace WebCore 2540 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptString.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698