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

Side by Side Diff: third_party/WebKit/Source/modules/encoding/TextEncoder.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO Created 3 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 TextEncoder::~TextEncoder() {} 53 TextEncoder::~TextEncoder() {}
54 54
55 String TextEncoder::encoding() const { 55 String TextEncoder::encoding() const {
56 String name = String(encoding_.GetName()).DeprecatedLower(); 56 String name = String(encoding_.GetName()).DeprecatedLower();
57 DCHECK_EQ(name, "utf-8"); 57 DCHECK_EQ(name, "utf-8");
58 return name; 58 return name;
59 } 59 }
60 60
61 DOMUint8Array* TextEncoder::encode(const String& input) { 61 NotShared<DOMUint8Array> TextEncoder::encode(const String& input) {
62 CString result; 62 CString result;
63 if (input.Is8Bit()) 63 if (input.Is8Bit())
64 result = codec_->Encode(input.Characters8(), input.length(), 64 result = codec_->Encode(input.Characters8(), input.length(),
65 WTF::kQuestionMarksForUnencodables); 65 WTF::kQuestionMarksForUnencodables);
66 else 66 else
67 result = codec_->Encode(input.Characters16(), input.length(), 67 result = codec_->Encode(input.Characters16(), input.length(),
68 WTF::kQuestionMarksForUnencodables); 68 WTF::kQuestionMarksForUnencodables);
69 69
70 const char* buffer = result.Data(); 70 const char* buffer = result.Data();
71 const unsigned char* unsigned_buffer = 71 const unsigned char* unsigned_buffer =
72 reinterpret_cast<const unsigned char*>(buffer); 72 reinterpret_cast<const unsigned char*>(buffer);
73 73
74 return DOMUint8Array::Create(unsigned_buffer, result.length()); 74 return NotShared<DOMUint8Array>(
75 DOMUint8Array::Create(unsigned_buffer, result.length()));
75 } 76 }
76 77
77 } // namespace blink 78 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/encoding/TextEncoder.h ('k') | third_party/WebKit/Source/modules/mediasource/SourceBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698