Check-in [a32e10a9ec]
Overview
Comment:ChromeOS: Updated to create a new thread for every request, since we must not run on the main thread
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a32e10a9ec4efa2fd4fe030aa10465686c7e4cad
User & Date: rkeene on 2016-02-11 16:03:51
Other Links: manifest | tags
Context
2016-02-11
16:04
ChromeOS: Hard-coded ID of smartcard manager app check-in: 2c83f782c6 user: rkeene tags: trunk
16:03
ChromeOS: Updated to create a new thread for every request, since we must not run on the main thread check-in: a32e10a9ec user: rkeene tags: trunk
16:02
ChromeOS: Made debugging build optional and non-default, as well as applying to the JavaScript portion of the extension check-in: 01a8bae109 user: rkeene tags: trunk
Changes

Modified build/chrome/cackey-chrome-init.cc from [f6b7a728d2] to [ce1d3f96e0].

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
...
115
116
117
118
119
120
121











































122
123
124
125
126
127
128
	public:
		explicit CACKeyInstance(PP_Instance instance, pp::Core *core) : pp::Instance(instance) {
			std::thread(&CACKeyInstance::pcscNaClInitWrapper, this, core).detach();
		}

		virtual ~CACKeyInstance() {}

		virtual void HandleMessage(const pp::Var& messagePlain) {
			int numCertificates, i;
			struct cackey_certificate *certificates;
			pp::VarDictionary *message;
			pp::VarDictionary *reply;
			pp::VarArray certificatesPPArray;
			pp::VarArrayBuffer *certificateContents;
			pp::Var command, target;

			/*
			 * The incoming message must be a dictionary
			 */
			if (!messagePlain.is_dictionary()) {
				return;
			}

			/*
			 * Process the appropriate command from the incoming message
			 */
			message = new pp::VarDictionary(messagePlain);

			/*
			 * Verify that this message is destined for us
			 */
			if (!message->HasKey("target")) {
				return;
			}

			target = message->Get("target");
			if (target.AsString() != "cackey") {
				return;
			}

			/*
			 * Determine what we are being asked to do
			 */
			if (!message->HasKey("command")) {
				return;
			}
			command = message->Get("command");

			/*
			 * Do the thing we are being asked to do
			 */
			if (command.AsString() == "listcertificates") {
				numCertificates = cackey_chrome_listCertificates(&certificates);
................................................................................
			}

			/*
			 * Send the reply back to the requestor, hopefully they are waiting for this message
			 */
			PostMessage(*reply);












































			return;
		}
};

class CACKeyModule : public pp::Module {
	public:
		CACKeyModule() : pp::Module() {}







|


<



|


|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46



























47
48
49
50
51
52
53
..
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
	public:
		explicit CACKeyInstance(PP_Instance instance, pp::Core *core) : pp::Instance(instance) {
			std::thread(&CACKeyInstance::pcscNaClInitWrapper, this, core).detach();
		}

		virtual ~CACKeyInstance() {}

		virtual void HandleMessageThread(pp::VarDictionary *message) {
			int numCertificates, i;
			struct cackey_certificate *certificates;

			pp::VarDictionary *reply;
			pp::VarArray certificatesPPArray;
			pp::VarArrayBuffer *certificateContents;
			pp::Var command;

			/*
			 * Extract the command
			 */



























			command = message->Get("command");

			/*
			 * Do the thing we are being asked to do
			 */
			if (command.AsString() == "listcertificates") {
				numCertificates = cackey_chrome_listCertificates(&certificates);
................................................................................
			}

			/*
			 * Send the reply back to the requestor, hopefully they are waiting for this message
			 */
			PostMessage(*reply);

			return;
		}

		virtual void HandleMessage(const pp::Var& messagePlain) {
			pp::VarDictionary *message;
			pp::Var target;

			/*
			 * The incoming message must be a dictionary
			 */
			if (!messagePlain.is_dictionary()) {
				return;
			}

			/*
			 * Process the appropriate command from the incoming message
			 */
			message = new pp::VarDictionary(messagePlain);

			/*
			 * Verify that this message is destined for us
			 */
			if (!message->HasKey("target")) {
				return;
			}

			target = message->Get("target");
			if (target.AsString() != "cackey") {
				return;
			}

			/*
			 * Determine what we are being asked to do
			 */
			if (!message->HasKey("command")) {
				return;
			}

			/*
			 * Process the request in another thread
			 */
			std::thread(&CACKeyInstance::HandleMessageThread, this, message).detach();

			return;
		}
};

class CACKeyModule : public pp::Module {
	public:
		CACKeyModule() : pp::Module() {}