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

Issue 749373002: - Implement Isolate.ping. (Closed)

Created:
6 years ago by Ivan Posva
Modified:
6 years ago
Reviewers:
siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

- Implement Isolate.ping. - Allow isolate library messages to be enqueued at the beginning of the message queue. R=asiva@google.com Committed: https://code.google.com/p/dart/source/detail?r=42193

Patch Set 1 #

Total comments: 10

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+189 lines, -42 lines) Patch
M runtime/lib/isolate_patch.dart View 1 2 chunks +8 lines, -1 line 0 comments Download
M runtime/vm/isolate.cc View 1 6 chunks +82 lines, -17 lines 0 comments Download
M runtime/vm/message.h View 1 3 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/message.cc View 1 2 chunks +29 lines, -4 lines 0 comments Download
M runtime/vm/message_handler.h View 1 1 chunk +3 lines, -1 line 0 comments Download
M runtime/vm/message_handler.cc View 1 2 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/message_test.cc View 1 3 chunks +59 lines, -11 lines 0 comments Download
M tests/isolate/isolate.status View 1 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (1 generated)
Ivan Posva
6 years ago (2014-11-24 22:02:44 UTC) #2
siva
LGTM with some comments and spec question about Denial of Service issue on back to ...
6 years ago (2014-12-01 19:48:05 UTC) #3
siva
LGTM with some comments and spec question about Denial of Service issue on back to ...
6 years ago (2014-12-01 19:48:06 UTC) #4
Ivan Posva
Committed patchset #2 (id:20001) manually as r42193 (presubmit successful).
6 years ago (2014-12-08 22:45:27 UTC) #5
Ivan Posva
6 years ago (2014-12-12 20:21:47 UTC) #6
Message was sent while issue was closed.
https://codereview.chromium.org/749373002/diff/1/runtime/vm/isolate.cc
File runtime/vm/isolate.cc (right):

https://codereview.chromium.org/749373002/diff/1/runtime/vm/isolate.cc#newcod...
runtime/vm/isolate.cc:178: const Smi& ping_type = Smi::Cast(obj3);
On 2014/12/01 19:48:05, siva wrote:
> why not
> intptr_t ping_value = Smi::Cast(obj3).Value();
> 
> and use ping_value in the if .. else statements.
> if (ping_value == kImmediateAction) { etc.

Done.

https://codereview.chromium.org/749373002/diff/1/runtime/vm/isolate.cc#newcod...
runtime/vm/isolate.cc:185: Message::kNormalPriority));
On 2014/12/01 19:48:05, siva wrote:
> How does the spec resolve a potential Denial of Service attack if repeated
PING
> messages with kImmediateAction setting are sent.

If you control the isolate, then you can do other kinds of Denial of Service,
such as terminating it.

https://codereview.chromium.org/749373002/diff/1/runtime/vm/message.cc
File runtime/vm/message.cc (right):

https://codereview.chromium.org/749373002/diff/1/runtime/vm/message.cc#newcode54
runtime/vm/message.cc:54: tail_ = msg;
On 2014/12/01 19:48:05, siva wrote:
> The "only element in queue" case is common always why not hoist that out to
make
> the code simpler to read:
> 
> if (head_ == NULL) {
>   // Only element in the queue.
>   ASSERT(tail_ == NULL);
>   head_= msg;
>   tail_ = msg;
> } else {
>   if (!before_events) {
>     ASSERT(tail_ != NULL);
>     // Append at the tail.
>     ...
>     ...
>   } else {
>     ASSERT(head_ != NULL);
>     if (head->dest_port() != Message::kIllegalPort) {
>       ...
>       ...
>     } else {
>       Message* cur = head_;
>       ...
>       ...
>     }
>   }
> }

Done.

https://codereview.chromium.org/749373002/diff/1/runtime/vm/message_test.cc
File runtime/vm/message_test.cc (right):

https://codereview.chromium.org/749373002/diff/1/runtime/vm/message_test.cc#n...
runtime/vm/message_test.cc:66: EXPECT(!queue.IsEmpty());
On 2014/12/01 19:48:05, siva wrote:
> Maybe the test would be better if you Enqueued another library message here
and
> it would test the case when we have to loop through the message and split when
> dest_port != KNormalPriority.
> i.e:
> 
> const char* str6 = "msg6";
> Message* msg6 = new Message(Message::kIllegalPort,
>                             AllocMsg(str6), strlen(str6) + 1,
>                             Message::kNormalPriority);
> queue.Enqueue(msg6, true);
> EXPECT(!queue.IsEmpty());

Done.

https://codereview.chromium.org/749373002/diff/1/runtime/vm/message_test.cc#n...
runtime/vm/message_test.cc:77: 
On 2014/12/01 19:48:05, siva wrote:
> Over here:
> 
> msg = queue.Dequeue();
> EXPECT(msg != NULL);
> EXPECT_STREQ(str6, reinterpret_cast<char*>(msg->data()));
> EXPECT(!queue.IsEmpty());

Done.

Powered by Google App Engine
This is Rietveld 408576698