| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 OwnPtr<BlobData> blobData = BlobData::create(); | 49 OwnPtr<BlobData> blobData = BlobData::create(); |
| 50 blobData->appendFile(path, 0, size, invalidFileTime()); | 50 blobData->appendFile(path, 0, size, invalidFileTime()); |
| 51 return Blob::create(BlobDataHandle::create(blobData.release(), size)); | 51 return Blob::create(BlobDataHandle::create(blobData.release(), size)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 WebBlob WebBlob::fromV8Value(v8::Local<v8::Value> value) | 54 WebBlob WebBlob::fromV8Value(v8::Local<v8::Value> value) |
| 55 { | 55 { |
| 56 if (V8Blob::hasInstance(value, v8::Isolate::GetCurrent())) { | 56 if (V8Blob::hasInstance(value, v8::Isolate::GetCurrent())) { |
| 57 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 57 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
| 58 Blob* blob = V8Blob::toImpl(object); | 58 Blob* blob = V8Blob::toImpl(object); |
| 59 ASSERT(blob); | 59 DCHECK(blob); |
| 60 return blob; | 60 return blob; |
| 61 } | 61 } |
| 62 return WebBlob(); | 62 return WebBlob(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void WebBlob::reset() | 65 void WebBlob::reset() |
| 66 { | 66 { |
| 67 m_private.reset(); | 67 m_private.reset(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void WebBlob::assign(const WebBlob& other) | 70 void WebBlob::assign(const WebBlob& other) |
| 71 { | 71 { |
| 72 m_private = other.m_private; | 72 m_private = other.m_private; |
| 73 } | 73 } |
| 74 | 74 |
| 75 WebString WebBlob::uuid() | 75 WebString WebBlob::uuid() |
| 76 { | 76 { |
| 77 if (!m_private.get()) | 77 if (!m_private.get()) |
| 78 return WebString(); | 78 return WebString(); |
| 79 return m_private->uuid(); | 79 return m_private->uuid(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 v8::Local<v8::Value> WebBlob::toV8Value(v8::Local<v8::Object> creationContext, v
8::Isolate* isolate) | 82 v8::Local<v8::Value> WebBlob::toV8Value(v8::Local<v8::Object> creationContext, v
8::Isolate* isolate) |
| 83 { | 83 { |
| 84 // We no longer use |creationContext| because it's often misused and points | 84 // We no longer use |creationContext| because it's often misused and points |
| 85 // to a context faked by user script. | 85 // to a context faked by user script. |
| 86 ASSERT(creationContext->CreationContext() == isolate->GetCurrentContext()); | 86 DCHECK(creationContext->CreationContext() == isolate->GetCurrentContext()); |
| 87 if (!m_private.get()) | 87 if (!m_private.get()) |
| 88 return v8::Local<v8::Value>(); | 88 return v8::Local<v8::Value>(); |
| 89 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate
); | 89 return toV8(m_private.get(), isolate->GetCurrentContext()->Global(), isolate
); |
| 90 } | 90 } |
| 91 | 91 |
| 92 WebBlob::WebBlob(Blob* blob) | 92 WebBlob::WebBlob(Blob* blob) |
| 93 : m_private(blob) | 93 : m_private(blob) |
| 94 { | 94 { |
| 95 } | 95 } |
| 96 | 96 |
| 97 WebBlob& WebBlob::operator=(Blob* blob) | 97 WebBlob& WebBlob::operator=(Blob* blob) |
| 98 { | 98 { |
| 99 m_private = blob; | 99 m_private = blob; |
| 100 return *this; | 100 return *this; |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |