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

Side by Side Diff: content/child/npapi/npruntime_util.cc

Issue 1483733002: Remove support for NPObjects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « content/child/npapi/npruntime_util.h ('k') | content/child/npapi/plugin_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/child/npapi/npruntime_util.h"
6
7 #include <stddef.h>
8 #include <stdint.h>
9
10 #include "base/pickle.h"
11 #include "third_party/WebKit/public/web/WebBindings.h"
12
13 using blink::WebBindings;
14
15 namespace content {
16
17 bool SerializeNPIdentifier(NPIdentifier identifier, base::Pickle* pickle) {
18 const NPUTF8* string;
19 int32_t number;
20 bool is_string;
21 WebBindings::extractIdentifierData(identifier, string, number, is_string);
22
23 if (!pickle->WriteBool(is_string))
24 return false;
25 if (is_string) {
26 // Write the null byte for efficiency on the other end.
27 return pickle->WriteData(string, strlen(string) + 1);
28 }
29 return pickle->WriteInt(number);
30 }
31
32 bool DeserializeNPIdentifier(base::PickleIterator* pickle_iter,
33 NPIdentifier* identifier) {
34 bool is_string;
35 if (!pickle_iter->ReadBool(&is_string))
36 return false;
37
38 if (is_string) {
39 const char* data;
40 int data_len;
41 if (!pickle_iter->ReadData(&data, &data_len))
42 return false;
43 DCHECK_EQ((static_cast<size_t>(data_len)), strlen(data) + 1);
44 *identifier = WebBindings::getStringIdentifier(data);
45 } else {
46 int number;
47 if (!pickle_iter->ReadInt(&number))
48 return false;
49 *identifier = WebBindings::getIntIdentifier(number);
50 }
51 return true;
52 }
53
54 } // namespace content
OLDNEW
« no previous file with comments | « content/child/npapi/npruntime_util.h ('k') | content/child/npapi/plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698